MVC detects what type of data it receive by contentType. Here is working example:
$(function () {
$.ajax({
type: 'Post',
cache: false,
dataType: 'json',
url: '/Workflow/Home/UpdateStepPositions',
data: JSON.stringify({ steps: ['1', '2', '3'] }),
contentType: 'application/json; charset=utf-8',
async: false,
success: function (data) {
console.debug(data);
},
error: function (data) {
console.debug(data);
}
});
});
Now everything ok with request:
Content-Type: application/json; charset=utf-8
X-Requested-With: XMLHttpRequest
and response:
Content-Type: application/json; charset=utf-8