ajaxStart is a global AjaxEvent (event since jQuery 1.0; .on() binding since 1.7). jQuery triggers it on document when the first qualifying Ajax request is about to begin — and only if no other global requests are already active.
Syntax
Start with these common calls. Keep them short and readable.
jQuery
$(document).on("ajaxStart", function () {
// runs when the first global Ajax request begins
});
// Order (batch):
// ajaxStart → ajaxSend → success|error → ajaxComplete → ajaxStop
// 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() — no request args
ajaxStop
Hide loading when no global requests remain
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("ajaxStart", handler).
Step 2
Make requests with $.ajax(), $.get(), $.post(), or .load().
Step 3
Show a spinner or status text inside the handler (no jqXHR args).
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 the first Ajax request begins after a click.
jQuery
$(document).on("ajaxStart", function () {
$(".log").text("Triggered ajaxStart handler.");
});
$(".trigger").on("click", function () {
$(".result").load("ajax/test.html");
});
Three $.get() calls start together
ajaxStart count → 1 (not 3)
ajaxStop fires once when all finish
How It Works
Idle → busy. The first request finds no active globals and fires start.
Already busy. The next two see activity in progress — no extra start.
Count. Your counter increments once per batch, not per call.
Frequently Asked Questions
ajaxStart is a global AjaxEvent that fires when the first qualifying jQuery Ajax request is about to be sent — and only when no other global Ajax requests are already in progress. Bind it with $(document).on("ajaxStart", 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("ajaxStart", fn) and remove with $(document).off("ajaxStart", fn).
No. It fires once when the first active global request begins. Three parallel $.ajax() calls still trigger ajaxStart only once. Pair it with ajaxStop, which fires when the last active global request finishes.
ajaxStart fires once at the start of a batch (no active requests yet). ajaxSend fires before every individual qualifying request and receives event, jqXHR, and settings. Use ajaxStart for page-wide loading UI; use ajaxSend for per-request work.
When $.ajax() or $.ajaxSetup() sets global: false, that request opts out of all global Ajax events. ajaxStart will not fire for it, and it does not count toward the active global request total used by ajaxStart/ajaxStop.
None that matter for typical use — function() { … }. Unlike ajaxSend or ajaxComplete, you do not get jqXHR or settings. Use those events when you need per-request details.
The shorthand method .ajaxStart(handler) is deprecated as of jQuery 3.5. Prefer $(document).on("ajaxStart", handler) — the event API this page teaches.