I am trying to pass the values from JavaScript string array variable into controller method. The method is called but the value is not being passed. Here is my example Controller
[HttpPost]
public IActionResult ReinstateEmployeeUpdate(List<string> employeeIds)
{
return View( );
}
<script type="text/javascript">
function UpdateEmployee() {
var employeeIds = [];
var employeeIds = ["346", "347"];
$.ajax({
type: "POST",
contentType: "application/json",
headers: { 'Content-Type': 'application/json' },
url: "/Employee/ReinstateEmployeeUpdate",
dataType: "json",
data: JSON.stringify(employeeIds),
success: function (response) {
console.log(response);
},
error: function (response) {
console.log(response.responseText);
}
});
}
</script>