function ajaxFileUpload() {
var alimaId = $('#alimaId').val();
var orderNum = $('#orderNum').val();
var image = $('#image').val();
if(alimaId == ""){
alert("请先保存数据");
return false;
}
if(orderNum == ""){
alert("图片排序不能为空");
return false;
}
if(image == ""){
alert("要上传的图片不能为空");
return false;
}
$.ajaxFileUpload
(
{
url: '/alimaImage/save', //用于文件上传的服务器端请求地址
data: {'alima.id':alimaId,'orderNum':orderNum},
secureuri: false, //是否需要安全协议,一般设置为false
fileElementId: 'image', //文件上传域的ID
dataType: 'json', //返回值类型 一般设置为json
success: function (data, status) //服务器成功响应处理函数
{
alert(data.status);
if (typeof (data.error) != 'undefined') {
}
},
error: function (data, status, e)//服务器响应失败处理函数
{
alert(e);
}
}
)
return false;
}
转载于:https://my.oschina.net/zhangmaoyuan/blog/1606295