.ajaxComplete()The .ajaxComplete() method in jQuery is used to register a handler to be callled when Ajax requests complete.
.ajaxComplete() syntax.ajaxComplete(handler)
handler is a function to call once the Ajax requests is complete.
.ajaxComplete() exampleShow a message when an Ajax request completes.
HTML
<button id="ajaxReq">Ajax Request</button> <div id="result"></div> <div id="msg"></div>
jQuery
$( "#ajaxReq" ).click(function() {
$( "#result" ).load( "/res/test/ajax/1.html" );
});
$( document ).ajaxComplete(function() {
$( "#msg" ).text( "Triggered ajaxComplete handler." );
});
Show a message "loading" when ajax request processes and hide the message when it completes
$("#ajax").ajaxStart(function(){
$("#loading").css("display","block");
});
$("#ajax").ajaxComplete(function(){
$("#loading").css("display","none");
});
