deferred.always( alwaysCallbacks [, alwaysCallbacks ] )Returns: Deferred
Description: Add handlers to be called when the Deferred object is either resolved or rejected.
version added: 1.6deferred.always( alwaysCallbacks [, alwaysCallbacks ] )
The argument can be either a single function or an array of functions. When the Deferred is resolved or rejected, the
alwaysCallbacks are called. Since
deferred.always() returns the Deferred object, other methods of the Deferred object can be chained to this one, including additional
.always() methods. When the Deferred is resolved or rejected, callbacks are executed in the order they were added, using the arguments provided to the
rejectWith method calls. For more information, see the documentation for Deferred object.
deferred.always() method receives the arguments that were used to
Deferred object, which are often very different. For this reason, it's best to use it only for actions that do not require inspecting the arguments. In all other cases, use explicit
.fail() handlers since the arguments will have well-known orders.
jQuery.get() method returns a
jqXHR object, which is derived from a Deferred object, we can attach a callback for both success and error using the