Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

jQuery ajaxComplete() method

jQuery ajaxComplete() method

jQuery AJAX methods jQuery AJAX methods

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 »


Definition and Usage

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

**Note:** As of jQuery version 1.8, this method is attached only to the document.

Unlike ajaxSuccess(), the function specified via ajaxComplete() runs when the request completes, even if the request was not successful.


Syntax

$(document).ajaxComplete(

function(event,xhr,options))

Parameters Description
function(event,xhr,options) Required. Specifies the function to run when the request completes.
 额外的参数:       

 
  • 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