HOME HTML CSS JAVASCRIPT SQL PHP JQUERY XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

jQuery ajaxComplete() Method

jQuery AJAX Methods jQuery AJAX Methods

Example

Show a "loading" indicator image while an AJAX request is going on:

$(document).ajaxStart(function(){
  $("#wait").css("display","block");
});
$(document).ajaxComplete(function(){
  $("#wait").css("display","none");
});

Try it yourself »

Definition and Usage

The ajaxComplete() method specifies a function to be run when an AJAX request completes.

Note: As of jQuery version 1.8, this method should only be attached to document.

Unlike ajaxSuccess(), functions specified with the ajaxComplete() method will run when the request is completed, even it is not successful.


Syntax

$(document).ajaxComplete(function(event,xhr,options))

Parameter Description
function(event,xhr,options) Required. Specifies the function to run when the request completes
Additional parameters:
  • event - contains the event object
  • xhr - contains the XMLHttpRequest object
  • options - contains the options used in the AJAX request


jQuery AJAX Methods jQuery AJAX Methods


Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates

SHARE THIS PAGE