I'm trying to append array to a list in the model or append any variable to the formData after getting the data form the form to the FormData just like the code below
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;
I've check that if I start an empty New FormData() and append the values its work so the exact problem with that code
var formData = new FormData($(form)[0])
the append won't work after using it ?? any help please