ajaxStop is a global AjaxEvent (since jQuery 1.0; .on() binding since 1.7). jQuery triggers it on document when the last qualifying Ajax request finishes and no others remain active. All registered handlers run.
Remember
$(document).on("ajaxStop", function () {
// runs when no global Ajax requests remain active
});
// Batch lifecycle:
// ajaxStart (first begins) → …requests… → ajaxStop (last ends)
// Opt out for one call:
$.ajax({ url: "/x", global: false });
Bind once on document, then hide UI when global Ajax activity ends.
Attach the handler to document with .on("ajaxStop", handler).
Pair with ajaxStart if you show a spinner when activity begins.
Make requests with $.ajax(), $.get(), $.post(), or .load().
Remember: the handler has nojqXHR / settings args.
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() — no extra arguments
ajaxStart
Recommended
Show loading UI when the first request begins
global: false
Optional
Skip all global Ajax events for that call
Pseudocode
Pseudocode
bind ajaxStop on document with handler()
when a jQuery Ajax request finishes:
if request.global === false:
do not count it / do not fire ajaxStop for it
return
decrement active global request count
fire ajaxComplete for this request
if active global request count === 0:
fire ajaxStop
for each registered handler:
call handler()
Reference
Cheat Sheet
Keep these facts handy while wiring global loading UI.
Topic
Detail
Bind
$(document).on("ajaxStop", handler)
Unbind
$(document).off("ajaxStop" [, handler])
Signature
function() — no jqXHR / settings
When
Last global request ends (active count → 0)
Since
Event 1.0 · .on() form 1.7 · document-only 1.9+
Pair with
$(document).on("ajaxStart", fn)
Also fires if
Last request cancelled via beforeSend → false
Opt out
global: false in $.ajax() / $.ajaxSetup()
Try it
Live Preview
Run real requests and watch ajaxStart / ajaxStop update the status once per batch.
Live demo uses a public JSON API. Needs network access.
Result
Ready — pick an action and click Run.
Code
jQuery Examples
Short, copy-ready snippets. Open DevTools Console, or use Try It Yourself for a live editor.
Example 1 — Document Handler + .load()
Official pattern: log a message when global Ajax activity ends after a click.
jQuery
$(document).on("ajaxStop", function () {
$(".log").text("Triggered ajaxStop handler.");
});
$(".trigger").on("click", function () {
$(".result").load("ajax/test.html");
});
Click #run-two → #loading shows (ajaxStart once)
Both finish → #loading hides (ajaxStop once)
Spinner stays visible for the whole batch
How It Works
Start. First global request → ajaxStart shows the spinner.
Overlap. More requests keep the spinner visible.
Stop. Last request ends → ajaxStop hides it.
No counting. jQuery tracks the active count for you.
Edge Cases & Pitfalls
Check these before relying on global loading handlers in production.
target
Bind on document only (1.9+)
Handlers on window or other elements will not receive global Ajax events.
scope
Not every request
ajaxStop fires once per idle batch. Use ajaxComplete when you need a hook after each call.
args
No jqXHR / settings
The handler is function(). Read response details from ajaxComplete instead.
global
global: false stays silent
Those requests never trigger ajaxStop and do not keep your spinner open.
Compatibility
Browser Support
ajaxStop has been part of jQuery since 1.0. Prefer $(document).on("ajaxStop", …) (1.7+). Since 1.9, handlers must attach to document.
✓ Stable · jQuery 1.0+
jQuery ajaxStop
Works in every browser that runs your loaded jQuery version. Prefer a current jQuery 3.x build for modern projects.
100%jQuery Ajax event
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
ajaxStopUniversal
Bottom line: Safe for everyday apps. Bind on document, pair with ajaxStart for spinners, and use global: false for silent background calls.
Analysis
Performance Notes
Approach
Cost
Best for
One light ajaxStop (toggle UI)
Cheap
Page-wide loading spinner
ajaxStart + ajaxStop pair
Cheap
Show / hide loading for a batch
Heavy DOM work on every stop
Expensive
Avoid — keep the handler tiny
Global handlers are fine when they stay light. Toggle visibility only, and prefer ajaxComplete or .always() for per-request work.
Remember
Key Takeaways
Role: global “all Ajax finished” hook — hide loading UI.
Bind:$(document).on("ajaxStop", fn) — document only since 1.9.
Pair: show on ajaxStart, hide on ajaxStop.
Per request: use ajaxComplete when you need jqXHR / settings.
One line:ajaxStop is jQuery’s global “batch idle” Ajax event — bind it on document.
Frequently Asked Questions
ajaxStop is a global AjaxEvent that fires when all qualifying jQuery Ajax requests have completed — when no global Ajax requests remain active. Bind it with $(document).on("ajaxStop", handler) (since 1.7).
Since jQuery 1.9, all global Ajax event handlers must be bound to document — not window or other elements. Use $(document).on("ajaxStop", fn) and remove with $(document).off("ajaxStop", fn).
ajaxComplete fires after every individual qualifying request finishes. ajaxStop fires once when the last active global request completes and the active count returns to zero. For three parallel calls: ajaxComplete runs three times; ajaxStop runs once.
No. It fires only when no global Ajax requests remain in progress. Pair it with ajaxStart, which fires once when the first request begins.
When $.ajax() or $.ajaxSetup() sets global: false, that request opts out of all global Ajax events. ajaxStop will not fire for it, and it does not count toward active global requests for ajaxStart/ajaxStop.
None beyond a normal function call — function() { ... }. Unlike ajaxComplete or ajaxSend, you do not receive jqXHR or settings. Use ajaxComplete when you need per-request details.
The shorthand method .ajaxStop(handler) is deprecated as of jQuery 3.5. Prefer $(document).on("ajaxStop", handler) — the event API this page teaches.