'Ajax Sending Null Parameters to Controller
I am trying to send 3 parameters using ajax to a Controller function. My ajax looks like
$.ajax({
url: '../saveFields',
data: {
fields : fieldIDs,
values : vals,
ID : <%= this.Model.DatabaseID %>,
},
success: function (data) {
alert("Success");
},
error: function (data) {
alert("Failed");
}
});
where fieldIDs and vals are arrays populated with integers. And the Controller call is
public ActionResult saveFields(int ID, int[] fields, int[] values)
I have a breakpoint set up right before the ajax call and the first line in the Controller function. Right before the ajax call, fieldIDs and vals are correctly populated, but then the first line of the Controller function the fields and values parameters are null. ID works fine. Any assistance as to what I am doing wrong would be greatly appreciated.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
