I have the following javascript code that builds up an array of objects and i am trying to push this to an asp.net-mvc action through an ajax post. I am trying to figure out what is wrong with this below ?
javascript:
var arr = [];
for (var i = 0; i < 5; i++) {
var obj = {
statusId: i,
resizeable: true,
rows: [1, 2, 3, 4, 5]
};
arr.push(obj);
}
$.ajax({
type: 'POST',
traditional: true,
url: '/MyController/UpdateMe',
data { info: arr },
success: function () {
alert("complete");
}
});
C# asp.net-mvc action:
public ActionResult UpdateMe(IEnumerable<UpdateInfo> info)
{
foreach (var item in info)
{
Console.Write(item.statusIs + " has + " item.rows.length() + " items ");
}
}
public class UpdateInfo
{
public int statusId {get;set;}
public bool resizable {get;set;}
public List<int> rows {get;set;}
}
