jQuery Deferred Methods

About This Index
This page is the jQuery Deferred index for the tutorial track. Each row links to a full guide with syntax, examples, and FAQs.
Learn the jQuery overview on /jquery. Use this page when you need a Deferred API such as $.Deferred(), deferred.done(), or deferred.then().
Start with $.Deferred(), then done(), fail(), and promise()—learn then() and resolve()/reject() next.
How to Call a Deferred Method
Create a Deferred, attach handlers, settle it, and share a read-only promise:
var dfd = $.Deferred();
dfd.done(function (value) {
console.log("ok:", value);
}).fail(function (err) {
console.error("fail:", err);
}).always(function () {
console.log("cleanup");
});
dfd.resolve("ready"); // or dfd.reject("oops")
dfd.state(); // "resolved"
var p = dfd.promise(); // read-only for callers
$.ajax("/api/data").then(function (data) {
return data.items;
}); jQuery Deferred Methods Table
All Deferred method guides in this jQuery tutorial series (22 tutorials).
Getting Started
5 methodsCreate Deferreds and attach the core success/failure listeners.
| Method | Description | Tutorial |
|---|---|---|
$.Deferred() | Create a Deferred for custom async workflows — register handlers, then resolve or reject. | Try it |
$.when() | Combine Deferreds, promises, or values into one promise — resolves when all resolve, rejects on first failure. | Try it |
deferred.done() | Run a callback when the Deferred resolves successfully. | Try it |
deferred.fail() | Run a callback when the Deferred is rejected. | Try it |
deferred.promise() | Return a read-only promise so callers cannot resolve or reject. | Try it |
Handlers & Chaining
5 methodsRegister callbacks, chain transforms, and handle errors in pipelines.
| Method | Description | Tutorial |
|---|---|---|
deferred.always() | Run a callback after resolve or reject — ideal for cleanup. | Try it |
deferred.catch() | Handle rejection at the end of a promise chain (like Promise.catch). | Try it |
deferred.then() | Chain success, failure, and progress handlers — return values flow to the next step. | Try it |
deferred.pipe() | Legacy filter/chain API — deprecated in jQuery 3+; use then() instead. | Try it |
deferred.progress() | Listen for interim progress updates from notify() or notifyWith(). | Try it |
Progress
2 methodsReport interim status before final resolve or reject.
| Method | Description | Tutorial |
|---|---|---|
deferred.notify() | Send a progress update while the Deferred is still pending. | Try it |
deferred.notifyWith() | Send progress with a custom this context and argument array. | Try it |
State & Settlement
7 methodsResolve, reject, inspect status, and bind context with With-methods.
| Method | Description | Tutorial |
|---|---|---|
deferred.resolve() | Settle as successful and pass results to done() handlers. | Try it |
deferred.resolveWith() | Resolve with a custom this context and arguments in an array. | Try it |
deferred.reject() | Settle as failed and pass reasons to fail() handlers. | Try it |
deferred.rejectWith() | Reject with a custom this context and arguments in an array. | Try it |
deferred.state() | Return "pending", "resolved", or "rejected" — preferred status check in jQuery 3+. | Try it |
deferred.isResolved() | Return true if resolved — deprecated; prefer state(). | Try it |
deferred.isRejected() | Return true if rejected — deprecated; prefer state(). | Try it |
Diagnostics & Hooks
3 methodsAdvanced hooks for logging exceptions and capturing async stacks in Deferred chains.
| Method | Description | Tutorial |
|---|---|---|
Deferred.exceptionHook() | Hook called when a then() callback throws — logs a console warning by default; override for reporting. | Try it |
Deferred.getErrorHook() | Optional hook returning an Error so exceptionHook can show where an async then() was set up. | Try it |
Deferred.getStackHook() | Deprecated older name of getErrorHook — use getErrorHook in jQuery 3.7+. | Try it |
Frequently Asked Questions
Start with $.Deferred()
Open the factory guide—syntax, examples, and FAQs.
CODETOFUN NEWS
Stay Ahead in Tech
Get the latest IT news, programming updates, and technology trends directly on your phone.
Your daily dose of tech, straight to your feed.
16 people found this page helpful
