我正在尝试将数组附加到模型中的列表,或者在将表单中的数据从FormData获取到FormData之后将任何变量附加到formData,就像下面的代码一样
function SubmitForm(form) {
$.validator.unobtrusive.parse(form);
var formData = new FormData($(form)[0]);
formData.append('RoleName', 'test');
if ($(form).valid()) {
$.ajax({
type: form.method,
url: form.action,
//"datatype": "json"
data: formData,
processData: false,
contentType: false,
success: function (data) {
if (data.success) {
Popup.dialog('close');
dataTable.ajax.reload();
$.notify(data.message, {
globalPosition: "top center",
className: "success"
})
} else {
Popup.dialog('close');
$.notify(data.message, {
globalPosition: "top center",
className: "error"
})
}
}
});
}
return false;
我检查一下,如果我启动一个空的New FormData()并将值附加到其中,那么该代码的确切问题
var formData = new FormData($(form)[0])
使用它后附加功能不起作用?任何帮助,请