var formData = new FormData();
let file = $("#addForm");
var o = $("#addForm").serializeArray();//获取form里所有的input输入框值
var img1 = $("#pmYyb").val();
var img2 = $("#yyzz").val();
var img3 = $("#pmYya").val();
var img3 = $("#pmHd").val();
formData.append('img1',$("#pmYyb")[0].files[0])
formData.append('img2',$("#yyzz")[0].files[0])
formData.append('img3',$("#pmYya")[0].files[0])
formData.append('img4',$("#pmHd")[0].files[0])
console.log(o)
for( let i = 0 ; i < o.length ; i++){
console.log(o[i].name,o[i].value)
formData.append(o[i].name,o[i].value)
}
// formData.append('file', $("#pmYya")[0].files[0]); //添加图片信息的参数
// formData.append('sizeid', 123); //添加其他参数,相当于字典里面的key,value,看你业务
$.ajax({
url: "",
type: 'POST',
async: false, //cache: false,
data: formData,
processData: false,
contentType: false, //dataType: "json",
beforeSend: function () {
uploading = true;
},
success: function (data) {
alert(data);
console.log(data)
// var o = $('form').serialize();
/*
if (data.code == 1) {
$("#logo").attr("src", data.msg);
} else {
showError(data.msg);
} */
uploading = false;
}
});