Dear team , i am trying to pass a array of values from ajax to controller but i always returing success or 200 despite hitting the controller.
Even with checkpoints it is not hitting
this is my ajax code
<script>
$(document).ready(function () {
$('#example').DataTable();
$('#btnSubmit').click(function () {
var ids = [];
$('#example tbody input[name="chkSelect"]:checked').each(function () {
ids.push($(this).attr('id'));
});
console.log(ids);
$.ajax({
type: "POST",
dataType: "JSON",
url: "",
data: { ids: ids },
success: function (data) {
// Handle the response from the controller
}
});
});
});
</script>
i have modidied the url to empty because i dont have enough reputation to post urls
and this is my conroller
public JsonResult AssignToHR(List<string> ids)
{
foreach (var id in ids)
{
// Do something with the ID
}
return Json(new { success = true });
}
i am not sure where i am wrong . please guide.