I have created a popup in which there is a textbox and a bunch of checkboxes. I have given all the checkboxes a value and these values are stored in an array. Now i want to pass this array and textbox value from Jquery to controller action. How can i do this ? I have tried on stackoverflow by all the keywords, but it doesn't work...
My jquery data is as follws:
$("#submit-button").click(function () {
var AccessBit = new Array(7);
AccessBit = BitLogic(); // integer array returned from BitLogic method
var role = $("#RoleName").val(); // Textbox value
var json = JSON.stringify(AccessBit);
alert(AccessBit);
$.ajax({
url: "/Role/BitLogic",
type: 'POST',
contentType: 'application/json; charset=utf-8',
data: json,
dataType: 'json',
success: function (data) {
console.log(data);
window.location.reload(true);
}
});
$("#createForm").dialog("close");
});
and Controller is as follows:
[HttpPost]
public void BitLogic(int[][] AccessBit)
{
}
How can i pass role value along with Accesbit array ? AccessBit is two dimensional integer array.
string role) and include in your ajax data parameter