ajaxSuccess is a global AjaxEvent (since jQuery 1.0; .on() binding since 1.7). jQuery triggers it on document whenever any qualifying Ajax request completes successfully. All registered handlers run.
Remember
$(document).on("ajaxSuccess", function (event, jqXHR, ajaxOptions, data) {
// runs after every successful qualifying Ajax request
});
// Order (on success):
// ajaxSuccess → ajaxComplete → (ajaxStop when idle)
// Opt out for one call:
$.ajax({ url: "/x", global: false });
Bind once on document, then any successful jQuery Ajax call can notify that handler.
Attach the handler to document with .on("ajaxSuccess", handler).
Make requests with $.ajax(), $.get(), $.post(), or .load().
Optionally filter with ajaxOptions.url (or other settings).
Read the body via jqXHR.responseText or the parsed data argument.
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, data)
ajaxOptions.url
Optional
Filter which requests you react to
global: false
Optional
Skip all global Ajax events for that call
Pseudocode
Pseudocode
bind ajaxSuccess on document with handler(event, jqXHR, ajaxOptions, data)
when a jQuery Ajax request finishes:
if request.global === false:
do not fire ajaxSuccess
return
if request succeeded:
fire ajaxSuccess
for each registered handler:
call handler(event, jqXHR, ajaxOptions, data)
else:
fire ajaxError instead
fire ajaxComplete
if no other global Ajax requests are active:
fire ajaxStop
Reference
Cheat Sheet
Keep these facts handy while wiring global success handlers.
Topic
Detail
Bind
$(document).on("ajaxSuccess", handler)
Unbind
$(document).off("ajaxSuccess" [, handler])
Signature
function(event, jqXHR, ajaxOptions, data)
When
Successful requests only (not errors)
Since
Event 1.0 · .on() form 1.7 · document-only 1.9+
Response body
jqXHR.responseText or parsed data
Filter
if (ajaxOptions.url === "...")
Opt out
global: false in $.ajax() / $.ajaxSetup()
Try it
Live Preview
Run a real $.get() and watch the global ajaxSuccess handler update the log.
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 any Ajax request succeeds after a click.
jQuery
$(document).on("ajaxSuccess", function () {
$(".log").text("Triggered ajaxSuccess handler.");
});
$(".trigger").on("click", function () {
$(".result").load("ajax/test.html");
});
Public $.get → ajaxSuccess runs
Private $.ajax({ global: false }) → silent
(per-request .done() still works)
How It Works
Default. Ajax calls participate in global events.
Opt out.global: false skips ajaxSuccess (and the other globals).
Local still works..done() / .fail() / .always() still run.
When. Use for silent prefetch, polling, or third-party widgets.
Example 5 — ajaxSuccess vs .done()
Global event sees every success; .done() is tied to one call.
jQuery
var globalCount = 0;
var doneCount = 0;
$(document).on("ajaxSuccess", function () {
globalCount++;
});
$.ajax("/a").done(function () { doneCount++; });
$.ajax("/b").done(function () { doneCount++; });
// After both succeed:
// globalCount === 2, doneCount === 2
// but each .done() only saw its own request
Two $.ajax() calls succeed
global ajaxSuccess count → 2
per-request .done() count → 2
How It Works
Global. One ajaxSuccess handler counts every successful request.
Local. Each .done() only increments for its own jqXHR.
Same totals. Counts can match, but the scope is different.
Choose. Site-wide toast → global event; one call’s UI → .done().
Edge Cases & Pitfalls
Check these before relying on global success handlers in production.
target
Bind on document only (1.9+)
Handlers on window or other elements will not receive global Ajax events.
scope
Success only
ajaxSuccess skips failures. Use ajaxError or ajaxComplete when outcome is not guaranteed.
global
global: false stays silent
Those requests never trigger ajaxSuccess. Per-request .done() still works.
cost
Heavy work in every handler hurts
Parsing large responseText or updating lots of DOM on every success can slow busy pages — filter first.
Compatibility
Browser Support
ajaxSuccess has been part of jQuery since 1.0. Prefer $(document).on("ajaxSuccess", …) (1.7+). Since 1.9, handlers must attach to document.
✓ Stable · jQuery 1.0+
jQuery ajaxSuccess
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
ajaxSuccessUniversal
Bottom line: Safe for everyday apps. Bind on document, filter by URL when needed, and use global: false for silent background calls.
Analysis
Performance Notes
Approach
Cost
Best for
One filtered ajaxSuccess
Cheap
Site-wide success toasts / logging
Per-request .done()
Cheap
UI update for a single call
Heavy DOM work every success
Expensive
Avoid — filter or debounce
Global handlers are fine when they stay light. Filter by URL before touching the DOM, and prefer .done() for request-specific work.
Remember
Key Takeaways
Role: global “request succeeded” hook — not for errors.
Bind:$(document).on("ajaxSuccess", fn) — document only since 1.9.
Filter: inspect ajaxOptions.url; read body via jqXHR.responseText or data.
Local alternative: use .done() for one-request success UI.
One line:ajaxSuccess is jQuery’s global success-only Ajax event — bind it on document.
Frequently Asked Questions
ajaxSuccess is a global AjaxEvent that fires whenever any qualifying jQuery Ajax request completes successfully. Bind it with $(document).on("ajaxSuccess", handler) (since 1.7). Every registered handler runs for every successful request. Failed requests trigger ajaxError instead.
Since jQuery 1.9, all global Ajax event handlers must be bound to document — not window or other elements. Use $(document).on("ajaxSuccess", fn) and remove with $(document).off("ajaxSuccess", fn).
No. It runs only on success. Use ajaxError for failures, or ajaxComplete when you need a hook after every finished request.
ajaxSuccess is a global document event — one handler observes every qualifying successful request on the page. done() is per-request on the jqXHR from $.ajax() — it runs only for that call. Use global events for site-wide success UI; use done() for request-specific updates.
When $.ajax() or $.ajaxSetup() sets global: false, that request opts out of all global Ajax events. ajaxSuccess will not fire for it. Per-request done(), fail(), and always() still run.
Four: function(event, jqXHR, ajaxOptions, data). 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); data is the processed response body.
The shorthand method .ajaxSuccess(handler) is deprecated as of jQuery 3.5. Prefer $(document).on("ajaxSuccess", handler) — the event API this page teaches.