ajaxComplete is a global AjaxEvent (since jQuery 1.0; .on() binding since 1.7). jQuery triggers it on document whenever any qualifying Ajax request finishes — success or error. All registered handlers run.
Syntax
Start with these common calls. Keep them short and readable.
jQuery
$(document).on("ajaxComplete", function (event, jqXHR, ajaxOptions) {
// runs after every qualifying Ajax request finishes
});
// Order (per request):
// ajaxSuccess | ajaxError → ajaxComplete → (ajaxStop when idle)
// Opt out for one call:
$.ajax({ url: "/x", global: false });
Call
What it does
document
Only valid bind target for global Ajax events
handler
function(event, jqXHR, ajaxOptions)
ajaxOptions.url
Filter which requests you react to
global: false
Skip all global Ajax events for that call
Load jQuery before your script (CDN or local file), then wrap DOM work in $(function () { ... }) when needed.
Parameters
Parameter
Description
Step 1
Attach the handler to document with .on("ajaxComplete", handler).
Step 2
Make requests with $.ajax(), $.get(), $.post(), or .load().
Step 3
Optionally filter with ajaxOptions.url (or other settings).
Return Value
Return Value
Description
jQuery object
Most setters and traversing helpers return the jQuery collection so you can chain more methods.
jQuery Examples
Example 1 — Document Handler + .load()
Official pattern: log a message when any Ajax request completes after a click.
jQuery
$(document).on("ajaxComplete", function () {
$(".log").text("Triggered ajaxComplete handler.");
});
$(".trigger").on("click", function () {
$(".result").load("ajax/test.html");
});
Bind..on("ajaxComplete") on document listens globally.
Click..load() starts an Ajax request under the hood.
Complete. When the request finishes, every ajaxComplete handler runs.
Example 2 — Filter by settings.url
Handlers run for every request — narrow them with the settings object.
jQuery
$(document).on("ajaxComplete", function (event, xhr, settings) {
if (settings.url === "ajax/test.html") {
$(".log").text(
"Triggered ajaxComplete handler. The result is " +
xhr.responseText
);
}
});
Each finished request →
#msg gains " Request Complete. "
Three parallel calls → three appends
How It Works
Global. One handler covers every qualifying Ajax call.
Append. Each completion adds another status fragment.
Count. Parallel requests each fire their own ajaxComplete.
Frequently Asked Questions
ajaxComplete is a global AjaxEvent that fires whenever any qualifying jQuery Ajax request finishes — success or failure. Bind it with $(document).on("ajaxComplete", handler) (since 1.7). Every registered handler runs for every completed request.
Since jQuery 1.9, all global Ajax event handlers must be bound to document — not window or other elements. Use $(document).on("ajaxComplete", fn) and remove with $(document).off("ajaxComplete", fn).
Yes. It always runs after a request completes. On success it follows ajaxSuccess; on failure it follows ajaxError. Use those outcome-specific events when you only care about one result.
ajaxComplete is a global document event — one handler observes every qualifying request on the page. always() is per-request on the jqXHR from $.ajax() — it runs only for that call. Use global events for site-wide UI; use always() for request-specific cleanup.
When $.ajax() or $.ajaxSetup() sets global: false, that request opts out of all global Ajax events. ajaxComplete will not fire for it. Per-request done(), fail(), and always() still run.
Three: function(event, jqXHR, ajaxOptions). event is the jQuery event; jqXHR is the request object (read responseText); ajaxOptions is the settings used to create the request (filter with ajaxOptions.url).
The shorthand method .ajaxComplete(handler) is deprecated as of jQuery 3.5. Prefer $(document).on("ajaxComplete", handler) — the event API this page teaches.