jQuery deferred.always()Method

jQuery 杂项方法jQuery Miscellaneous Methods

Example

$(function () { $.get( "test.php" ).always(function() { alert( "The $.get method with success and error callback parameters is complete." ); }); })

Try it »

Definition and Usage

When the Deferred object is resolved or rejected, the deferred.always() function calls the added handlers.

Tip:The argument can be a function or an array of functions. Since deferred.always() returns a Deferred object, other deferred object methods can be chained, including additional .always methods. When the Deferred object is resolved or rejected, the callback functions are executed in the order they were added, and can be called with arguments such as those passed to resolve, reject, resolveWith, or rejectWith.


Syntax

deferred.always( alwaysCallbacks [, alwaysCallbacks ] )

Parameter Description
alwaysCallbacks Function type - a function or array of functions called when the Deferred object is resolved or rejected
alwaysCallbacks Optional. Function type - a function or array of functions called when the Deferred object is resolved or rejected


jQuery 杂项方法jQuery Miscellaneous Methods

Other Extensions