jquery: ajax example

2015-03-22 00:00:00 IN1 , 2023-04-10 14:16:28 IN1


this is a simple code example to remember how it works, to show how the structure looks like.

$.ajax({
    url: 'Controller.php',
    type: 'post',
    data: oFormData,
    contentType: false,
    processData: false,
    dataType: 'json',
    statusCode: {
        404: function() {
            console.log("404 page not found");
        }
    },
    success: function(oResponse, status, xhr){

        console.log('success oResponse', oResponse);
        console.log('success status', status);
        console.log('success xhr', xhr);
    },
    complete: function(xhr, status){

        console.log('complete xhr', xhr);
        console.log('complete status', status);
    },
    error: function(xhr, status, error){

        console.log('error xhr', xhr);
        console.log('error status', status);
        console.log('error error', error);
    }
}).done(function() {
    console.log('done', true);
});
This website uses Cookies to provide you with the best possible service. Please see our Privacy Policy for more information. Click the check box below to accept cookies. Then confirm with a click on "Save".