Using MVC3 I am trying to accomplish the following. I have a table which has a number of values, using ajax I want to be able to select the remove checkbox (for any number of rows) which is part of the table.
The using ajax post the result to the controller for processing. The issue I currently have is I cannot get the controller to accept the data coming from the ajax post.
I am making use of jQuery and json to make the ajax call.
function removeRooms() {
var jdata = { 'mRooms': [] };
$('input:checked').each(function () {
jdata['mRooms'].push($(this).val()); })
$.ajax({
url: "/room/removeselectedroom/@Model.mRoomid",
type: "POST",
dataType: "json",
data: jdata,
success: function (msg) {
$('#mRooms').html(msg);
}
})
}
Any help you can give or resources would be appreciated.
EDIT:: One extra thing. I am getting through a IEnumerable object but there is a parameter an item in position one of the list with the value 'on' strange as there is only numbers in my checkboxes.