The reject() method marks a jQuery Deferred as failed. It runs fail() and catch() handlers with your error reason — and prevents done() from firing. This tutorial covers syntax, five examples, comparisons with resolve() and fail(), and when to reject vs resolve.
01
Syntax
dfd.reject(reason)
02
State
rejected
03
fail()
Handlers run
04
vs resolve
One settlement
05
Owner only
Not on promise
06
Since 1.5
Core Deferred API
Fundamentals
Introduction
Not every async task succeeds. Validation can fail, networks time out, and servers return errors. When you own a $.Deferred(), you signal failure by calling reject() — the mirror image of resolve() for success.
Listeners registered with fail() or catch() receive the rejection reason. Consumers holding only a promise() cannot call reject() — only the module that created the Deferred settles it.
Concept
Understanding the reject() Method
reject() transitions a pending Deferred into the rejected state. jQuery invokes every queued fail(), catch(), and always() handler with the arguments you pass to reject().
Once rejected, the state is permanent — you cannot resolve() the same Deferred afterward. done() handlers never run on a rejected Deferred.
💡
Beginner Tip
Register fail()before calling reject() if handlers must run synchronously in the same turn — same rule as done() before resolve(). The reference example attaches handlers first, then rejects inside setTimeout, which is correct.
Foundation
📝 Syntax
General form of deferred.reject:
jQuery
deferred.reject( [ args ] )
Parameters
args (optional) — rejection reason(s) forwarded to fail() handlers: string, Error, object, or multiple values.
Return value
Returns the same Deferred object for chaining (though state is now locked to rejected).
Deferred waits; fail() handlers may already be registered.
Before
2
reject()
State locks to rejected; fail/catch/always handlers run.
Settle
3
No done()
Success handlers are skipped; further resolve/reject calls ignored.
Final
=
⚠
Handled failure
User sees error UI via fail(); cleanup via always().
Important
📝 Notes
Only call reject() on Deferreds you own — not on promises returned to you.
Always pair public async APIs with consumer-side fail() or catch().
Use descriptive rejection reasons — strings, Error objects, or structured data.
state() returns "rejected" after reject (preferred over deprecated isRejected() in jQuery 3+).
For custom this in fail handlers, use rejectWith() next.
Compatibility
Browser Support
deferred.reject() has been available since jQuery 1.5 alongside the Deferred API. It works in jQuery 1.5+, 2.x, and 3.x.
✓ jQuery 1.5+
jQuery Deferred.reject()
Universal wherever jQuery Deferred runs. jqXHR uses the same rejection machinery when AJAX requests fail.
100%With jQuery loaded
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.reject()Universal
Bottom line: Core API for signaling async failure in jQuery since 1.5. Always handle rejections on the consumer side.
Wrap Up
🎉 Conclusion
The deferred.reject() method settles a Deferred as failed. Call it when validation fails, networks error, or business rules block success — then let fail() and catch() inform the user.
Next, explore rejectWith() when fail handlers need a custom this context, or review resolve() for the success counterpart.
Reject without any fail/catch handler in user flows
Expose reject() on public promise objects
Swallow errors silently after reject
Assume done() runs after reject
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about reject()
How to signal failure on a jQuery Deferred.
5
Core concepts
📝01
Syntax
dfd.reject(args)
API
⚠02
State
rejected
Failed
fail03
fail()
Runs on reject
Listen
1x04
Once
Locked state
Final
vs05
resolve
Opposite
Pair
❓ Frequently Asked Questions
reject() settles the Deferred as failed. It triggers fail(), catch(), and the rejection branch of always() handlers, passing optional rejection values (error message, object, etc.). The state locks to rejected — done() will not run.
reject() is called by the Deferred owner to signal failure. fail() registers a callback that runs when rejection happens. Think: reject() fires the event; fail() listens for it.
No. A Deferred settles once. If it already resolved, a later reject() is ignored. Likewise, resolve() after reject() has no effect.
Any value — a string message, Error object, HTTP status, or multiple arguments like reject(status, body, xhr). fail() handlers receive the same arguments.
No. Rejection triggers fail/catch/always, not progress. Send final progress updates before reject() if needed.
Use rejectWith(context, args) when fail() handlers need a specific this value and arguments in an array — same pattern as resolveWith() and notifyWith().
Did you know?
When a jQuery AJAX request fails, the jqXHR object rejects its internal Deferred automatically — you handle it with .fail() without calling reject() yourself. Custom helpers that wrap non-jQuery async code use reject() the same way jQuery does internally for HTTP errors.