Easy Tutorial
❮ Html Innerwidth Traversing Next ❯

jQuery ajaxComplete() Method

jQuery AJAX Methods

Example

Displays a "loading" indicator while an AJAX request is in progress:

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

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 the document.

Unlike ajaxSuccess(), the function specified by the ajaxComplete() method will run when the request completes, even if the request was not successful.


Syntax

Parameter Description
function(event,xhr,options) Required. Specifies the function to be run when the request completes. <br> Additional parameters: <br> event - Contains the event object <br> xhr - Contains the XMLHttpRequest object <br> options - Contains the options used in the AJAX request

jQuery AJAX Methods

❮ Html Innerwidth Traversing Next ❯