Skip to main content
deleted 27 characters in body
Source Link
webdeveloper
  • 17.3k
  • 3
  • 51
  • 47

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

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

MVC detects what type of data it receive by contentType. Here is working example:

$(function () {
    $.ajax({
        type: 'Post',
        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
added 123 characters in body
Source Link
webdeveloper
  • 17.3k
  • 3
  • 51
  • 47

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

MVC detects what type of data it receive by contentType. Here is working example:

$(function () {
    $.ajax({
        type: 'Post',
        cache: false,
        dataType: 'json',
        url: '/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);
        }
    });
});

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
added 123 characters in body
Source Link
webdeveloper
  • 17.3k
  • 3
  • 51
  • 47

MVC detects what type of data it receive by contentType. Here is working example:

$(function () {
    $.ajax({
        type: 'POST''Post',
        cache: false,
        dataType: 'json',
        url: '/Workflow/Home/UpdateStepPositions',
        data: JSON.stringify({ 'steps'steps: ['1', '2', '3'] }),
        contentType: 'application/json; charset=utf-8',
        async: false,
        success: function (data) {
            console.debug(data);
        },
        error: function (data) {
            console.debug(data);
        }
    });
});

MVC detects what type of data it receive by contentType. Here is working example:

    $.ajax({
        type: 'POST',
        cache: false,
        dataType: 'json',
        url: '/Workflow/Home/UpdateStepPositions',
        data: { 'steps': ['1', '2', '3'] },
        success: function (data) {
            console.debug(data);
        },
        error: function (data) {
            console.debug(data);
        }
    });

MVC detects what type of data it receive by contentType. Here is working example:

$(function () {
    $.ajax({
        type: 'Post',
        cache: false,
        dataType: 'json',
        url: '/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);
        }
    });
});
added 362 characters in body
Source Link
webdeveloper
  • 17.3k
  • 3
  • 51
  • 47
Loading
Source Link
webdeveloper
  • 17.3k
  • 3
  • 51
  • 47
Loading