ajaxSend is a global AjaxEvent (since jQuery 1.0; .on() binding since 1.7). jQuery triggers it on document just before any qualifying Ajax request is sent. All registered handlers run.
Remember
$(document).on("ajaxSend", function (event, jqXHR, ajaxOptions) {
// runs just before every qualifying Ajax request is sent
});
// Order (per request):
// ajaxStart → ajaxSend → (response) → ajaxSuccess|ajaxError → ajaxComplete
// Opt out for one call:
$.ajax({ url: "/x", global: false });
Bind once on document, then any jQuery Ajax call can notify that handler before it leaves.
Attach the handler to document with .on("ajaxSend", handler).
Make requests with $.ajax(), $.get(), $.post(), or .load().
Optionally filter with ajaxOptions.url (or other settings).
Use global: false on requests that must stay silent.
Prefer beforeSend when logic belongs to one call only.
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
bind ajaxSend on document with handler(event, jqXHR, ajaxOptions)
when a jQuery Ajax request is about to be sent:
if request.global === false:
do not fire ajaxSend
return
if this is the first active global request:
fire ajaxStart
fire ajaxSend
for each registered handler:
call handler(event, jqXHR, ajaxOptions)
send the HTTP request
// response is not available yet — use ajaxComplete later
Reference
Cheat Sheet
Keep these facts handy while wiring global Ajax send hooks.
Topic
Detail
Bind
$(document).on("ajaxSend", handler)
Unbind
$(document).off("ajaxSend" [, handler])
Signature
function(event, jqXHR, ajaxOptions)
When
Just before each qualifying request is sent
Since
Event 1.0 · .on() form 1.7 · document-only 1.9+
Response body
Not available yet — use ajaxComplete
Filter
if (ajaxOptions.url === "...")
Opt out
global: false in $.ajax() / $.ajaxSetup()
Try it
Live Preview
Run a real $.get() and watch the global ajaxSend handler update the log before the request leaves.
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 is about to be sent after a click.
jQuery
$(document).on("ajaxSend", function () {
$(".log").text("Triggered ajaxSend handler.");
});
$(".trigger").on("click", function () {
$(".result").load("ajax/test.html");
});
Public $.get → ajaxSend runs
Private $.ajax({ global: false }) → silent
(per-request beforeSend still works)
How It Works
Default. Ajax calls participate in global events.
Opt out.global: false skips ajaxSend (and the other globals).
Local still works.beforeSend / .done() / .fail() still run.
When. Use for silent prefetch, polling, or third-party widgets.
Example 5 — ajaxSend vs beforeSend
Global event sees every request; beforeSend is tied to one call.
jQuery
var globalCount = 0;
var localCount = 0;
$(document).on("ajaxSend", function () {
globalCount++;
});
$.ajax({
url: "/a",
beforeSend: function () { localCount++; }
});
$.ajax({
url: "/b",
beforeSend: function () { localCount++; }
});
// After both start sending:
// globalCount === 2, localCount === 2
// but each beforeSend only saw its own request
Two $.ajax() calls start
global ajaxSend count → 2
per-request beforeSend count → 2
How It Works
Global. One ajaxSend handler counts every outgoing request.
Local. Each beforeSend only increments for its own call.
Same totals. Counts can match, but the scope is different.
Choose. Site-wide logging → global event; one call’s setup (or cancel) → beforeSend.
Edge Cases & Pitfalls
Check these before relying on global Ajax send handlers in production.
target
Bind on document only (1.9+)
Handlers on window or other elements will not receive global Ajax events.
timing
No response yet
ajaxSend runs before the HTTP call. Do not read responseText here — use ajaxComplete.
cancel
Cannot cancel from ajaxSend
Return false from per-request beforeSend to abort. Global ajaxSend is for observation, not cancellation.
global
global: false stays silent
Those requests never trigger ajaxSend. Per-request callbacks still work.
Compatibility
Browser Support
ajaxSend has been part of jQuery since 1.0. Prefer $(document).on("ajaxSend", …) (1.7+). Since 1.9, handlers must attach to document.
✓ Stable · jQuery 1.0+
jQuery ajaxSend
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
ajaxSendUniversal
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 ajaxSend
Cheap
Site-wide outbound logging
Per-request beforeSend
Cheap
Setup for a single call
Heavy DOM work every send
Expensive
Avoid — filter or debounce
Global handlers are fine when they stay light. Filter by URL before touching the DOM, and prefer beforeSend for request-specific work.
Remember
Key Takeaways
Role: global “request about to leave” hook — before the HTTP call.
Bind:$(document).on("ajaxSend", fn) — document only since 1.9.
Filter: inspect ajaxOptions.url; response is not available yet.
Local alternative: use beforeSend for one-request setup or cancel.
One line:ajaxSend is jQuery’s global before-send Ajax event — bind it on document.
Frequently Asked Questions
ajaxSend is a global AjaxEvent that fires just before any qualifying jQuery Ajax request is sent. Bind it with $(document).on("ajaxSend", handler) (since 1.7). Every registered handler runs for every outgoing request.
Since jQuery 1.9, all global Ajax event handlers must be bound to document — not window or other elements. Use $(document).on("ajaxSend", fn) and remove with $(document).off("ajaxSend", fn).
ajaxSend fires before the request leaves the browser. ajaxComplete fires after it finishes (success or error). Order: ajaxStart → ajaxSend → (response) → ajaxSuccess|ajaxError → ajaxComplete → ajaxStop.
ajaxSend is a global document event — one handler observes every qualifying request. beforeSend is a per-request $.ajax() option — it runs only for that call. Use ajaxSend for site-wide logging; use beforeSend for one-call setup (and to cancel by returning false).
When $.ajax() or $.ajaxSetup() sets global: false, that request opts out of all global Ajax events. ajaxSend will not fire for it. Per-request beforeSend, done(), fail(), and always() still run.
Three: function(event, jqXHR, ajaxOptions). event is the jQuery event; jqXHR is the request object; ajaxOptions is the settings used to create the request (filter with ajaxOptions.url). The response is not available yet.
The shorthand method .ajaxSend(handler) is deprecated as of jQuery 3.5. Prefer $(document).on("ajaxSend", handler) — the event API this page teaches.