I am trying to post an array to my MVC Action but I continue to receive a null value.
//Send List of services to controller
$('#submitButton').click(function () {
$.ajax({
contentType: 'application/json; charset=utf-8',
dataType: 'json',
type: 'GET',
url: '/Appointments/GetListOfServices',
data: JSON.stringify({ CheckedItems: checkedItems }),
traditional: true,
success: function (data) {
alert(data.Result);
},
failure: function (response) {
$('#result').html(response);
console.log("failed");
}
});
});
When I call the GetListOfServices function I am receiving a null value
public JsonResult GetListOfServices(int[] CheckedItems)
{
Console.WriteLine(CheckedItems);
return Json(new { message= "OK" });
}
When I examine the console and the Network tabs in my browser, it is showing the following:

traditional: trueoption & don't useJSON.stringify.HttpPostinJsonResultaction andtype: 'POST'in your AJAX. The JS array is never intended to use withGETmethod which sends data through query string.