I want to pass array data from my View to my Controller. However, when the View passes the data to the Controller, they are no rows passed.
What is wrnog with the below example? How can I pass an array to my Controller?
View:
$.ajax({
type: 'POST',
url: urlString,
data: {ids: testData},
datatype: "json",
traditional: true,
success: function () {
alert("test");
},
error: function (jqXHR, textStatus, errorThrown) {
alert("jqXHR:" + jqXHR.status + " errorThrown: " + errorThrown);
}
});
Controller:
[HttpPost]
[ActionName("DefaultAction")]
public void SaveExceptions(int[] ids) //ids has no data
{
//do stuff
}