deferred.pipe() filters and/or chains a Deferred. Optional doneFilter, failFilter, and progressFilter map resolve, reject, and progress values. It returns a new Promise (since jQuery 1.6; progress filter since 1.7).
Syntax
Start with these common calls. Keep them short and readable.
jQuery
deferred.pipe(doneFilter [, failFilter [, progressFilter]])
doneFilter(value) → next success value or Promise
failFilter(reason) → next reject value (or Promise)
progressFilter(n) → next progress value
null / omitted filter → pass status & values through
prefer then() in new code
Call
What it does
deferred.pipe()
Learn jQuery deferred.pipe(): filter and chain Deferred values with doneFilter, failFilter, and progressFilter, migrate to then(), examples, pitfalls, and FAQs.
Load jQuery before your script (CDN or local file), then wrap DOM work in $(function () { ... }) when needed.
Parameters
Parameter
Description
Step 1
Build a Deferred (or use a promise from AJAX / helpers).
Step 2
Call pipe(doneFilter) — optionally add fail and progress filters.
Step 3
Return a value or another promise from the filter.
Return Value
Return Value
Description
jQuery object
Most setters and traversing helpers return the jQuery collection so you can chain more methods.
jQuery Examples
Example 1 — Transform a Resolved Value
Multiply the resolve value in doneFilter; the piped promise gets the new number.
jQuery
var defer = $.Deferred();
var filtered = defer.pipe(function (value) {
return value * 2;
});
defer.resolve(5);
filtered.done(function (value) {
console.log(value); // 10
});
First task.fetchUserId() resolves with { id: 42 }.
Return a promise. The filter starts fetchProfile(42) and returns it.
Wait. The piped chain pauses until that second promise resolves.
Frequently Asked Questions
pipe() returns a new Promise that filters a Deferred’s resolve, reject, and (optionally) progress values. doneFilter runs on resolve; failFilter on reject; progressFilter on notify. Return a value or another promise to feed the next step.
Yes. As of jQuery 1.8, deferred.pipe() is deprecated. Use deferred.then() instead — it replaces pipe() and follows Promises/A+ semantics in jQuery 3+.
done() only registers a side-effect callback — its return value is ignored. pipe() (and then()) use the filter’s return value as the next link’s input.
The piped promise stays rejected, but with the new value. Official pattern: map the reason, then attach .fail(). To recover into success, return a resolved Deferred from failFilter.
Yes. Return a Deferred or Promise from doneFilter; the piped chain waits until that promise settles, then continues with its value.
No. Prefer then(onFulfilled, onRejected) in jQuery 3+. Keep pipe() only when reading or maintaining legacy jQuery 1.x/2.x chains.