I have code that I pass from jQuery to my ASP.Net MVC controller and it works fine. I am now trying to replicate the same functionality in a new situation and the parameter shows up as null when I put a breakpoint in my controller code.
Can anyone see anything wrong with the code below. In firebug I see that calendarIds is a perfectly populated array but it shows up as null on the server side.
Here is my jQuery code:
var calendarIds = [];
$('#box2View option').each(function () {
calendarIds.push($(this).val());
});
$.post(
'/EventCalendar/UpdateVisibleCalendars/',
{ calendarIds: calendarIds },
function (data) {
//do some callback stuff here (not relevant for question)
},
"html"
);
Here is my controller code
public ActionResult UpdateVisibleCalendars(int[] calendarIds)
{
// right here i check calendarIds and its always NULL :(
return null;
}
calendarIds=1,2,3,4,5where as it is expectingcalendarIds=1&calendarIds=2&calendarIds=3...