As, title, can't pass object to backend, but simple string ("hihi" as below) is work.
I tried to use JSON.stringify(reportNameList) to let it become a string, but I still can't see it was passed to backend.
submitHandler: function(form) {
$(form).ajaxSubmit(submitOptions);
}
var submitOptions = {
async: false,
clearForm: false,
resetForm:false,
url: "/ReportEngine/saveALL",
type: 'POST',
data: {
//"reportNameList": JSON.stringify(reportNameList),
"reportNameList": "hihi",
},
success: function (data) {
console.log(data);
},
beforeSend: showRequest,
error: function (data) {
console.log(data);
}
};
It's because when var submitOptions is defined, reportNameList is not defined yet, so just write whole option in ajax() function, this problem is solved.