English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
When the Ajax request is completed, the ajaxComplete() method will specify a function to be called. This is an AjaxEvent.
jQuery will trigger the ajaxComplete event every time an Ajax request is completed. At this time, all handlers registered with the ajaxComplete() method will be executed.
Note:From jQuery 1.8From version X, this method should only be attached to the document.
$(document).ajaxComplete(function(event, xhr, options))
Display a message when the Ajax request is completed:
$("(document").ajaxComplete(function(){ $("#done").text("Ajax request completed"); });Test See‹/›
Using event, xhr, and options parameters, you can get more useful output:
$("(document").ajaxComplete(function(event, xhr, options){ $("#done").append(options.url); $("#done").append(xhr.status); $("#done").append(event.type); });Test See‹/›
Parameters | Description |
---|---|
function(event, xhr, options) | Specify a function to run when the request is completed Parameters:
|