$.Deferred() (same as jQuery.Deferred()) is a factory that returns a new Deferred object (since jQuery 1.5). Officially it creates a chainable utility for registering callbacks, invoking them, and relaying success or failure of sync or async work — the same pattern used by $.ajax().
Create, attach handlers, settle when the work finishes.
Call $.Deferred() (optionally with a beforeStart function).
Attach done / fail / then / always handlers.
Run your async or sync work.
Call resolve() or reject() once when finished.
Return promise() if other code should listen but not settle.
Piece
Required?
Role
beforeStart
No
Runs with the new Deferred as this and as arg 1
Handlers
Usually
done, fail, then, always, …
Return
—
New Deferred object
Pseudocode
Pseudocode
Deferred([beforeStart]):
create object in state = pending
if beforeStart: call it(deferred)
return deferred
on resolve(args):
if already settled: ignore
state = resolved
run done / then success / always queues
on reject(args):
if already settled: ignore
state = rejected
run fail / then fail / always queues
promise():
return read-only view (no resolve / reject)
Reference
Cheat Sheet
Core facts for the Deferred factory.
Topic
Detail
Syntax
jQuery.Deferred( [ beforeStart ] )
Alias
$.Deferred( [ beforeStart ] )
Starts as
pending
Success
resolve() / resolveWith()
Failure
reject() / rejectWith()
Safe export
promise() (no settle methods)
Late handlers
Still run immediately if already settled
Since
jQuery 1.5
Try it
Live Preview
Create a Deferred and compare resolve, reject, locked state, and promise().
Browser demo of $.Deferred — same ideas as the examples below.
Result
done: Hello
state: resolved
Code
jQuery Examples
Short, copy-ready snippets. Open DevTools Console, or use Try It Yourself for a live editor.
Example 1 — Create and Resolve
Factory → attach done() → resolve() with a value.
jQuery
var dfd = $.Deferred();
dfd.done(function (value) {
console.log("done:", value);
});
dfd.resolve("Hello from Deferred");
// done: Hello from Deferred
beforeStart. Runs once before the factory returns the Deferred.
Attach outside. Handlers can still be added after construction.
Notify then resolve. Progress fires first; then done runs.
Edge Cases & Pitfalls
Watch these when building custom Deferred helpers.
locked
Second resolve / reject is ignored
After the first settle, the state never changes. Extra resolve() calls do nothing.
export
Return promise(), not the Deferred
Handing out the full Deferred lets callers settle your task early. Prefer promise().
late
Handlers after settle still run
Adding done() to an already-resolved Deferred runs the callback immediately with the stored args.
one
One Deferred per operation
Reuse a settled Deferred for a new request only if you create a fresh one — never “reset” an old object.
native
Not the same as native Promise
jQuery Deferred is Promises/A-inspired and jQuery-specific. Prefer Deferred APIs inside jQuery code; use native Promise when you leave the jQuery stack.
Compatibility
Browser Support
$.Deferred() is part of jQuery’s Deferred API (since 1.5). It works in any browser where your jQuery build runs.
✓ jQuery 1.5+ · Browsers
jQuery $.Deferred()
Supported wherever jQuery 1.5+ is loaded — Chrome, Firefox, Safari, Edge, and other browsers with a matching jQuery build.
100%With jQuery 1.5+
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
$.Deferred()jQuery 1.5+
Bottom line: Use $.Deferred() whenever you need jQuery-style async control. Load jQuery 1.5+ (3.x recommended for modern projects).
Analysis
Performance Notes
Operation
Cost
Best for
$.Deferred()
O(1) create
One object per async task
Attach handlers
O(1) each
Queuing done / fail / then
resolve / reject
O(n) handlers
Running queued callbacks once
Creating a Deferred is cheap. Cost grows with how many handlers you attach and how heavy each callback is. Keep settle handlers short — update UI, map a value, or forward an error message.
Remember
Key Takeaways
Role: factory for a new Deferred representing one async unit of work.
Settle once:resolve or reject locks the state forever.
Export: return promise() so callers listen but cannot settle.
Since: jQuery 1.5 — the foundation for ajax-style Deferred APIs.
One line:$.Deferred() creates the object you resolve or reject — return promise() when sharing it.
Frequently Asked Questions
$.Deferred() (same as jQuery.Deferred()) is a factory that creates a new Deferred object — a chainable handle for one async operation you control with resolve(), reject(), and callback methods like done() and fail().
A Deferred can resolve or reject itself. deferred.promise() returns a read-only Promise that exposes done/fail/then but hides resolve/reject — return that when sharing async work with other code.
pending (not finished), resolved (success), or rejected (failure). After resolve or reject, the state is locked; further settle calls are ignored.
Yes. An optional beforeStart function runs just before the factory returns, with the new Deferred as this and as the first argument. Use it to attach early callbacks or start async setup.
jqXHR from $.ajax() implements the Deferred interface. $.Deferred() lets you build the same callback patterns for your own timers, validators, and helpers.
Deferred objects were added in jQuery 1.5 and remain available in modern 1.x, 2.x, and 3.x builds.