var checkedValues = $('.required:checked').map(function () {
return this.value;
}).get();
$.getJSON('@Url.Action("testcata", "home")' +"?Type=" + "@(Session["typ"])" + "&city=" + "@(Session["cit"])" + "&chkd=" + checkedValues,
function (data) {
//code
})
In controller:
public ActionResult testcata(string Type, int? city, int[] chkd)
{
//code
}
I am trying to get the values of check-boxes which are checked to pass through json function. why the method in the controller taking null as an argument for more than one selected check values ? I am having a int[] chkd parameter in the function . It shows null.
Type,cityandchkdasgetparameters, not as passed in function.inton controller side change it array ofstringinstead.JsonResultinstead ofActionResultwhich should returnJson()response. Try MakingPostrequest to the method. In this sense you need to make some fair adjustments in your code.