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 »
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. |
额外的参数:
jQuery AJAX methods