jQuery ajaxComplete()Method
Example
Display a "loading" indicator while an AJAX request is in progress:
$(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 run when the AJAX request completes.
Note:As of jQuery version 1.8, this method is only attached to the document.
Unlike ajaxSuccess(), functions specified via the ajaxComplete() method will run when the request completes, even if the request was 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:
|
Other extensions
jQuery AJAX Methods