jQuery Deferred isRejected() Method

Beginner
5 min read
Updated: Oct 2026
4 examples
Live preview

What Is isRejected()?

deferred.isRejected() was a boolean check: true after reject() / rejectWith(), otherwise false. It took no arguments. Today, use state() instead.

Remember
// OLD (jQuery 1.5–1.7 only — removed in 1.8)
dfd.isRejected()  → true | false

// MODERN replacement
dfd.state() === "rejected"

state(): "pending" | "resolved" | "rejected"
NeedUse (today)
Was it rejected?dfd.state() === "rejected"
Was it resolved?dfd.state() === "resolved"
React to failuredfd.fail(fn)

How to Check Rejected State

Prefer state() (since jQuery 1.7). Call it after the Deferred may have settled.

  1. Create or receive a Deferred / Promise.
  2. Call dfd.state() at a checkpoint (after reject, or inside fail).
  3. Compare with === "rejected" for the old isRejected() meaning.
  4. For reactions (UI messages, retries), register fail() instead of polling.
PieceRequired?Role
DeferredYesObject whose status you inspect
ArgumentsNonestate() / old isRejected() take none
Return (modern)—"pending" | "resolved" | "rejected"

Pseudocode

Pseudocode
function isRejected(deferred):          // legacy idea
    return deferred.state() === "rejected"

// True only after reject / rejectWith
// False while pending or after resolve

Cheat Sheet

Quick facts for status checks and the removal timeline.

TopicDetail
Old syntaxdeferred.isRejected()
Added / gone1.5 → deprecated 1.7 → removed 1.8
Modern checkdfd.state() === "rejected"
Returns (old)Boolean
True whenAfter reject() / rejectWith()
False whenPending or resolved
Best reaction APIfail() / catch() — not polling

Live Preview

Settle a Deferred and see state() === "rejected" (modern isRejected).

Uses state() — isRejected() is not available in modern jQuery.

Result
state(): rejected
isRejected?: true

jQuery Examples

All demos use state() === "rejected" so they work on current jQuery. Open DevTools Console, or use Try It Yourself.

Example 1 — After reject()

Once rejected, the modern check returns true.

jQuery
var dfd = $.Deferred();
dfd.reject("Network error");

var isRejected = dfd.state() === "rejected";
console.log(dfd.state());   // "rejected"
console.log(isRejected);   // true
Try It Yourself

How It Works

  1. Create a pending Deferred.
  2. Reject with a reason — state becomes "rejected".
  3. Compare state() === "rejected" (old isRejected()).
  4. Result is true for that Deferred forever after.

Example 2 — Still Pending

Before settle, the check is false.

jQuery
var dfd = $.Deferred();

console.log(dfd.state());                 // "pending"
console.log(dfd.state() === "rejected");  // false
Try It Yourself

How It Works

  1. Fresh Deferred starts as "pending".
  2. No reject yet — nothing has failed.
  3. Check === "rejected" → false.
  4. Tip: Do not treat pending as success or failure.

Example 3 — After resolve()

Success is not rejection — the check stays false.

jQuery
var dfd = $.Deferred();
dfd.resolve("ok");

console.log(dfd.state());                 // "resolved"
console.log(dfd.state() === "rejected");  // false
Try It Yourself

How It Works

  1. Resolve settles as success → "resolved".
  2. Rejected? No — state is locked to resolved.
  3. Compare still yields false.
  4. Use === "resolved" (or old isResolved) for success checks.

Example 4 — Prefer fail() Over Polling

React to rejection with a callback; use state() only when you need a snapshot.

jQuery
var dfd = $.Deferred();

dfd.fail(function (err) {
  console.log("handled: " + err);
  console.log("rejected?: " + (dfd.state() === "rejected"));
});

dfd.reject("timeout");
// handled: timeout
// rejected?: true
Try It Yourself

How It Works

  1. Register fail(fn) for the error path.
  2. Reject triggers the handler with the reason.
  3. Inside fail, state() is already "rejected".
  4. Pattern: callbacks for behavior; state() for debugging / guards.

Edge Cases & Pitfalls

Avoid these mistakes when checking Deferred status.

removed

Do not call isRejected() on jQuery 1.8+

The method is gone. Calling it throws. Always use state() === "rejected".

poll

Do not poll in a tight loop

Spinning on state() wastes CPU. Prefer fail() / always() for async completion.

timing

Pending is still false

Checking immediately after starting a timer or AJAX returns false until reject runs.

once

State never flips back

After reject or resolve, later reject/resolve calls are ignored. Status stays locked.

Browser Support

deferred.isRejected() existed only in jQuery 1.5–1.7 (deprecated 1.7, removed 1.8). Modern pages must use deferred.state() (since 1.7), which works in all browsers with current jQuery.

✓ Removed · use state()

deferred.isRejected()

Legacy API only. Current jQuery (1.8+) exposes state() — compare with "rejected" for the same boolean idea.

N/A Legacy API
Google Chrome All versions · Desktop & Mobile
Full support
Mozilla Firefox All versions · Desktop & Mobile
Full support
Apple Safari All versions · macOS & iOS
Full support
Microsoft Edge All versions · Chromium & Legacy
Full support
Internet Explorer IE 6+ · Legacy environments
Full support
Opera All modern versions
Full support
state() Use this

Bottom line: Do not call isRejected() in modern code. Write dfd.state() === "rejected" instead.

Performance Notes

ApproachCostBest for
state() === "rejected"O(1)Guards / debugging
fail(fn)O(1) registerReacting to errors
Polling state()WastefulAvoid

A single state() read is cheap. The cost is wrong design — polling instead of callbacks.

Key Takeaways

  • Meaning: true only after the Deferred was rejected.
  • Modern: dfd.state() === "rejected".
  • Removed: isRejected() is gone since jQuery 1.8.
  • React: use fail() for errors; state() for snapshots.

One line: isRejected() is legacy — write dfd.state() === "rejected" and prefer fail() for handling errors.

Frequently Asked Questions

isRejected() returned true when the Deferred had been rejected (fail path), and false while pending or after a successful resolve. It took no arguments.
No. It was deprecated in jQuery 1.7 and removed in 1.8. In current jQuery, use dfd.state() === "rejected" instead.
Call deferred.state(). It returns "pending", "resolved", or "rejected". Compare with === "rejected" for the old isRejected() meaning.
No. fail() registers a callback for when rejection happens. isRejected() (and state()) are synchronous status checks — they do not listen for future rejects.
At known checkpoints — after reject(), inside fail(), or for debugging. Prefer fail()/catch() for reacting to errors instead of polling.
No. Once settled, the state is locked. state() is "rejected" only after reject()/rejectWith(), never after resolve().

Next: isResolved()

See the legacy success check and its modern state() replacement.

isResolved() 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.

8 people found this page helpful