I want to post data to the server. In the form, I've selected checked checkboxes and retrieve values from them. I used the following code:
$(".DownloadSelected").click(function () {
var values = [];
var chks = $(':checkbox[name="ids"]:checked');
$(chks).each(function (i) {
values[i] = $(this).val();
});
$.post("/Documents/DownloadSelected/", { ids: values });
});
In controller I have this:
[HttpPost]
public ActionResult DownloadSelected(int[] ids)
{
}
The problem is that in controller I retrieved null values in int[]ids array.
Can anybody help me?