jQuery Ajax Events

Beginner
⏱️ Hub guide
📚 Updated: Jul 2026
🚀 24 event tutorials

What You’ll Learn

Global Ajax events let you observe every jQuery request from one place on document. Bind ajaxComplete for finish notifications, ajaxStart and ajaxStop for loading indicators, and use global: false when a call should stay private.

01

ajaxStart

First request

02

ajaxSend

Before send

03

ajaxSuccess

2xx response

04

ajaxComplete

Always runs

05

global:false

Opt out

06

24 guides

Full index

Introduction

When your app loads data with $.ajax(), $.get(), or $.post(), jQuery can broadcast lifecycle events to every listener on the page. Global handlers are ideal for spinners, request logging, and shared error toasts — without copying the same callback onto dozens of individual calls.

What Are jQuery Global Ajax Events?

Global Ajax events are named strings passed to $(document).on()"ajaxStart", "ajaxSend", "ajaxSuccess", "ajaxError", "ajaxComplete", and "ajaxStop". Each handler receives the native event plus jQuery-specific arguments such as the jqXHR object and request settings. They fire only for requests where global is not set to false.

💡
Beginner Tip

Bind global handlers on document with .on("ajaxComplete", fn), .on("ajaxStart", fn), and the other global event names — since jQuery 1.9, $(document) is the supported target for all global Ajax events.

📝 Syntax

Minimal global handler workflow:

jQuery
$(document).on("ajaxStart", function() {
  $("#spinner").show();
});
$(document).on("ajaxComplete", function(event, xhr, settings) {
  console.log("Finished:", settings.url);
});
$(document).on("ajaxStop", function() {
  $("#spinner").hide();
});
$.ajax({ url: "/api/ping", global: false });

👀 ajaxComplete vs always() vs global:false

Three ways to react when a request finishes — pick the right tool:

$(document).on("ajaxComplete", fn) → global handler — every qualifying request on the page .always(fn) on jqXHR → per-request callback — one $.ajax() call only { global: false } → skip global events for this request ajaxStart → ajaxSend → ajaxSuccess|ajaxError → ajaxComplete → ajaxStop

Ajax Event Tutorial Index

Search by event name or browse by category. Each tutorial includes syntax, try-it examples, and FAQs.

Core Ajax API

4 tutorials

Make HTTP requests with jQuery.ajax() — the foundation behind $.get(), $.post(), and .load().

EventDescriptionTutorial
jQuery.ajax() methodCore Ajax API — configure HTTP requests with a settings object and chain done(), fail(), and always() on jqXHR.Open
jQuery.ajaxPrefilter() methodRegister global hooks that modify Ajax options before each request is sent — custom defaults, abort-on-retry, and dataType filters.Open
jQuery.ajaxSetup() methodSet default Ajax options for every future request — jQuery recommends explicit per-call options or a wrapper instead.Open
jQuery.ajaxTransport() methodRegister custom transport factories with send() and abort() — last resort for non-standard dataTypes and protocols.Open

Ajax Shorthands

5 tutorials

Readable one-liners built on $.ajax() — GET, POST, and JSON helpers.

EventDescriptionTutorial
jQuery.get() methodGET shorthand for $.ajax() — load data with url, optional query data, success callback, and dataType in one line.Open
jQuery.post() methodPOST shorthand for $.ajax() — send data in the request body with url, data, success callback, and dataType in one line.Open
jQuery.getJSON() methodGET JSON shorthand — dataType json is preset so success callbacks receive a parsed object or array.Open
jQuery.getScript() methodGET script shorthand — load and execute JavaScript files with dataType script preset and cache busting by default.Open
jQuery .load() methodCollection method — fetch HTML from a URL and inject it into matched elements, with optional fragment selector.Open

Ajax Utilities

3 tutorials

Serialize data for URLs and request bodies — the helper behind $.serialize() and manual query building.

EventDescriptionTutorial
jQuery.param() methodSerialize plain objects, arrays, and form data into URL-encoded query strings for Ajax requests and GET URLs.Open
jQuery .serialize() methodEncode successful form controls as a URL query string — ready for $.post() and Ajax form submission.Open
jQuery .serializeArray() methodEncode form controls as an array of name/value objects — iterate, transform, then pass to $.param().Open

Global Ajax Events

12 tutorials

Observe every Ajax request on the page from a single document handler.

EventDescriptionTutorial
ajaxStart eventRegister a document-level handler when the first global Ajax request begins — pair with ajaxStop for loading UI.Open
.ajaxStart() methodDeprecated shorthand for binding global ajaxStart handlers on document — migrate to .on('ajaxStart').Open
ajaxSend eventRegister a document-level handler that runs before any global Ajax request is sent.Open
.ajaxSend() methodDeprecated shorthand for binding global ajaxSend handlers on document — migrate to .on('ajaxSend').Open
ajaxError eventRegister a document-level handler that runs when any global Ajax request completes with an error.Open
.ajaxError() methodDeprecated shorthand for binding global ajaxError handlers on document — migrate to .on('ajaxError').Open
ajaxSuccess eventRegister a document-level handler when any global Ajax request completes successfully.Open
.ajaxSuccess() methodDeprecated shorthand for binding global ajaxSuccess handlers on document — migrate to .on('ajaxSuccess').Open
ajaxComplete eventRegister a document-level handler that runs when any global Ajax request finishes — success or error.Open
.ajaxComplete() methodDeprecated shorthand for binding global ajaxComplete handlers on document — migrate to .on('ajaxComplete').Open
ajaxStop eventRegister a document-level handler when the last global Ajax request completes — pair with ajaxStart for loading UI.Open
.ajaxStop() methodDeprecated shorthand for binding global ajaxStop handlers on document — migrate to .on('ajaxStop').Open

Conclusion

jQuery global Ajax events centralize request lifecycle handling on document. Bind ajaxStart and ajaxStop for loading UI, listen to ajaxComplete when you need a hook that runs on success or failure, and set global: false on calls that should stay invisible to the rest of the page.

❓ Frequently Asked Questions

Global Ajax events fire on document whenever jQuery initiates an Ajax request through $.ajax(), $.get(), $.post(), or load(). They let you show spinners, log traffic, or run cleanup for every request from one place instead of repeating callbacks on each call.
Before 1.9, handlers could attach to window. jQuery 1.9+ standardized on document as the event target. Use $(document).on('ajaxComplete', fn) — the same pattern as other delegated events — and .off() when you need to remove them.
Setting global: false on a single request opts that call out of global events. ajaxStart, ajaxSend, ajaxSuccess, ajaxError, ajaxComplete, and ajaxStop will not fire for it. Per-request done(), fail(), and always() callbacks still run normally.
ajaxComplete is a global document event — one handler sees every qualifying request on the page. always() is per-request on the jqXHR returned by $.ajax() — it runs only for that one call. Use global events for site-wide UI; use always() for request-specific cleanup.
For each request: ajaxSend fires before the request is sent, then ajaxSuccess or ajaxError when it finishes, then ajaxComplete (always, success or error). ajaxStart fires when the first active global request begins; ajaxStop fires when the last one completes. Multiple parallel requests share one ajaxStart/ajaxStop pair.
Start with the jQuery.ajax() tutorial to learn how to make requests and chain done(), fail(), and always() on jqXHR. Then read the global event tutorials — ajaxStart through ajaxStop — to observe every request from one document handler. Pair with Deferred concepts from the previous hub when chaining multiple $.ajax() calls.

Start with jQuery.ajax()

Learn the core Ajax API — settings, jqXHR, and promise-style callbacks — before global events.

jQuery.ajax() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

6 people found this page helpful