Event after load ajax jquery

jQuery And Ajax

To start, we review ajax define:

Ajax= Asynchronous JavaScript and XML.

Ajax is not a new programming language, but a new way to use existing standards.

Ajax is the art of exchanging data with a server, and updating parts of a web page – without reloading the whole page.

(refer w3schools.com)

With any ajax, as below example:

$.ajax({
    url: 'demo.php',
    type: 'POST',
    async: true,
    data: 'name=khactung',
    success: function(data) {
        //called when successful
    },
    error: function(e) {
        //called when there is an error
    }
});

 

jQuery And Ajax

After apply any ajax, you want perform a any action after ajax process load completes, please using this below code.

 

$(document).ready(function(){
        $(document).ajaxComplete(function(event, request, settings) {
            alert('Ajax load successful!');
        });
});

ajaxComplete() : method perform after ajax load complete.