.ajaxComplete(handler) is jQuery’s legacy shorthand (since 1.0) for binding a global Ajax “request finished” handler on document. It runs after every qualifying request — success or error. Internally it is sugar for .on("ajaxComplete", handler).
Remember
// Deprecated (since 3.5)
$(document).ajaxComplete(function (event, jqXHR, ajaxOptions) {
// runs after every qualifying Ajax request finishes
});
// Modern replacement
$(document).on("ajaxComplete", handler);
// Bind only — no no-arg .ajaxComplete() trigger form
// Opt out: $.ajax({ url: "/x", global: false })
Recognize the legacy call, know its three handler arguments, and migrate to .on() / .off().
Attach the handler to document with .ajaxComplete(handler) (legacy) or .on("ajaxComplete", handler) (preferred).
Make requests with $.ajax(), $.get(), $.post(), or .load().
Optionally filter with ajaxOptions.url and read jqXHR.responseText.
Remove with .off("ajaxComplete", handler) — not .unbind().
Use global: false on requests that must stay silent.
Piece
Required?
Role
document
Yes (1.9+)
Only valid bind target for global Ajax events
handler
Yes
function(event, jqXHR, ajaxOptions)
ajaxOptions.url
Optional
Filter which requests you react to
global: false
Optional
Skip all global Ajax events for that call
Pseudocode
Pseudocode
call $(document).ajaxComplete(handler)
→ internally: $(document).on("ajaxComplete", handler)
when a jQuery Ajax request finishes:
if request.global === false:
do not fire ajaxComplete
return
fire ajaxSuccess or ajaxError first
fire ajaxComplete
for each registered handler:
call handler(event, jqXHR, ajaxOptions)
to migrate:
replace .ajaxComplete(fn) with .on("ajaxComplete", fn)
remove with .off("ajaxComplete", fn)
Run $.get() → count increments
Click Remove → .off("ajaxComplete", onComplete)
Next $.get() → handler no longer runs
How It Works
Named fn. Anonymous handlers cannot be removed individually.
Bind..ajaxComplete(onComplete) stores that reference.
Remove..off("ajaxComplete", onComplete) detaches exactly that handler.
Avoid. Do not use deprecated .unbind("ajaxComplete") in new code.
Edge Cases & Pitfalls
Watch for these when reading or migrating legacy Ajax code.
deprecated
Do not use in new code
.ajaxComplete(handler) is deprecated since 3.5. Prefer .on("ajaxComplete").
target
Bind on document only (1.9+)
Handlers on window or other elements will not receive global Ajax events.
trigger
No no-arg trigger form
Unlike .click(), calling .ajaxComplete() with no arguments does not fire the event.
global
global: false stays silent
Those requests never trigger .ajaxComplete() handlers. Per-request callbacks still work.
Compatibility
Browser Support
The .ajaxComplete() method has been part of jQuery since 1.0. Since 1.9, handlers must attach to document. Binding via .ajaxComplete(handler) is deprecated since 3.5 but still functional in jQuery 3.x.
✓ Deprecated · jQuery 1.0+
jQuery .ajaxComplete()
Works wherever your loaded jQuery version runs Ajax. Prefer .on('ajaxComplete') for new projects. fetch() and axios do not trigger jQuery global events.
100%With jQuery Ajax
Google ChromeAll versions · Desktop & Mobile
Full support
Mozilla FirefoxAll versions · Desktop & Mobile
Full support
Apple SafariAll versions · macOS & iOS
Full support
Microsoft EdgeAll versions · Chromium & Legacy
Full support
Internet ExplorerIE 6+ · Legacy environments
Full support
OperaAll modern versions
Full support
.ajaxComplete()Legacy API
Bottom line: Safe in legacy jQuery projects. Migrate bindings to .on('ajaxComplete') and cleanup to .off('ajaxComplete') when updating code.
Analysis
Performance Notes
Approach
Cost
Best for
One filtered global handler
Cheap
Site-wide logging / cleanup
Per-request .always()
Cheap
Cleanup for a single call
Heavy DOM work every complete
Expensive
Avoid — filter or debounce
Legacy and modern binds have the same cost. Keep handlers light, filter by URL before touching the DOM, and prefer .always() for request-specific work.
Remember
Key Takeaways
Role: legacy global “request finished” bind — success or error.
Migrate:$(document).on("ajaxComplete", fn) — preferred since 3.5.
Args:function(event, jqXHR, ajaxOptions) — filter with ajaxOptions.url.
Cleanup: use .off("ajaxComplete", fn) — not .unbind().
One line:.ajaxComplete() is deprecated sugar for .on("ajaxComplete") on document.
Frequently Asked Questions
The .ajaxComplete(handler) method binds a global function that runs whenever any qualifying jQuery Ajax request finishes — success or error. Attach it to document: $(document).ajaxComplete(fn). It is bind-only (no trigger form). Deprecated since jQuery 3.5; use $(document).on("ajaxComplete", handler) instead.
Yes. $(document).ajaxComplete(handler) has been deprecated since jQuery 3.5 (available since 1.0). Prefer $(document).on("ajaxComplete", handler) for new code. Legacy bindings still work in jQuery 3.x; migrate when you touch those files. Remove handlers with $(document).off("ajaxComplete", handler).
ajaxComplete is a global Ajax event, not a DOM event on a specific element. Since jQuery 1.9, all global Ajax handlers — including .ajaxComplete(handler) — must bind to document. Correct legacy form: $(document).ajaxComplete(fn). Modern form: $(document).on("ajaxComplete", fn).
The API lists handler as Function(), but the callback receives three arguments — the same as the ajaxComplete event: function(event, jqXHR, ajaxOptions). Use jqXHR.responseText for the body and ajaxOptions.url to identify the request.
Replace $(document).ajaxComplete(fn) with $(document).on("ajaxComplete", fn). Use $(document).off("ajaxComplete", fn) for cleanup instead of .unbind(). Under the hood, .ajaxComplete(handler) already delegates to .on("ajaxComplete") — migration is a straight rename for simple bindings.
Yes. jQuery 3.x keeps .ajaxComplete(handler) for backward compatibility. It still binds correctly on document. Docs mark it deprecated since 3.5 to steer new projects toward .on(). Prefer the modern API covered in the jQuery ajaxComplete event tutorial.