Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

jQuery deferred.always() method

jQuery deferred.always() method

jQuery Miscellaneous MethodsjQuery Miscellaneous Methods

Example

$

(

function

(

)

{

$.

get

(

"

test.php

"

)

.

always

(

function

(

)

{

alert

(

"

The $.get method with success and error callback parameters has completed.

"

)

;

}

)

;

}

)

Try it »


Definition and Usage

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

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


Syntax

deferred.always( alwaysCallbacks [, alwaysCallbacks ] )

Parameters Description
alwaysCallbacks Function type: A function or an array of functions called when the Deferred object is resolved or rejected
alwaysCallbacks Optional. Function type: A function or an array of functions called when the Deferred object is resolved or rejected

jQuery Miscellaneous MethodsjQuery Miscellaneous Methods