jquery.form.js的$.ajaxSubmit
$.ajax只提交form以文本方式,如果异步提交包含<input type="file">上传是传过不过去,需要使用jquery.form.js的$.ajaxSubmit
$("#imgForm").ajaxSubmit({
url:"/user/updateImg.json",
type: "post",
dataType : "json",
beforeSend:function(){
alert(1)
},
complete:function(){
alert(2)
},
success:function(data){
if(data.success){
$("#img").attr("src",data.data);
}else{
alert(data.resultMessage);
}
}
})
浙公网安备 33010602011771号