ajax 文件与表单数据同时提交
2018-12-17 本文已影响9人
BestbpF
代码
var formData = new FormData($("#yourFormId")[0]); //此处id为form表单的id
$.ajax({
url: "your upload url",
type: 'POST',
data: formData,
cache: false,
contentType: false,
processData: false,
success: function (res) {
},
error: function (data) {
}
});