I work on asp.net razor page . i face issue when sent list of id from jQuery ajax to razor
page it display on razor page as count 0 although it display on console of browser two items
on array
public JsonResult OnGetListIdUpdated(List<int> selectedIds) { return new JsonResult(selectedIds); } $(document).ready(function () { $('#reprintdatabtn').click(function (event) { event.preventDefault(); var selectedIds = []; $("input[name='chkSel']:checked").each(function() { var id = $(this).closest("tr").find("td:last").text(); if (id !== "") { selectedIds.push(parseInt(id)); } }); console.log(selectedIds); $.ajax({ url: '?handler=ListIdUpdated', type: "GET", dataType: "json", data: { selectedIds: selectedIds }, success: function (response) { $("#lblRowsCount").html(response.counter); $('#msgstatus').text(response.messageStatus); // Handle the server response here } }); }); });
so on browser console.log(selectedIds); i get data correctly as below
console.log(selectedIds);
[ 16810, 16811 ]
and when debug this line below on razor it display null
public JsonResult OnGetListIdUpdated(List<int> selectedIds)
so why this issue happen please