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

jQuery deferred.reject() method

jQuery deferred.reject() method

jQuery Miscellaneous MethodsjQuery Miscellaneous Methods


Definition and Usage

The deferred.reject() function is used to reject a deferred object and call any failCallbacks with the given arguments.

**Note:** 1. Typically only the creator of the deferred object can call this method. You can call deferred.promise() to return a restricted Promise object, preventing other code from changing the state of the deferred object or reporting its state.
2. When the deferred object is rejected, any failCallbacks added via deferred.then or deferred.fail are called. The callbacks are executed in the order in which they were added. The args passed to deferred.reject() are passed to each callback. After the deferred object enters the rejected state, any failCallbacks added afterwards are executed immediately with the arguments passed to .reject().


Syntax

deferred.reject( args )

Parameters Description
args Object type: Optional arguments passed to the failCallbacks

jQuery Miscellaneous MethodsjQuery Miscellaneous Methods