1. We are no longer limited to a single success, error, or complete handler. 2. Instead of simple callbacks, these hooks are now self-managed FIFO callback queues. 3. Callbacks may be attached even AFTER an AJAX request – or any observable task – has completed.
helper. Q: How does this work? A: All AJAX methods now return an object containing a “promise”. This is a read-only view into the result of the task. $.when() waits for all requests to execute, and once they do, callbacks attached will fire as appropriate (depending on the success/fail state of the task)
when working with deferreds. Methods available to all deferreds (AJAX, $.when(), and manual): It’s also important to note that you don’t have access to all of the properties of the deferred object. Only the promise, callback-binding methods, and the isRejected() and isResolved() methods to check a deferred’s state.
approach to writing asynchronous tasks. 2. Old school callbacks limit us to single success, error, and complete methods. Deferreds let us structure our flow how we see fit. 3. No longer have to worry about queuing and de queuing of callbacks.