jQuery deferred.state()Method

jQuery 杂项方法jQuery Miscellaneous Methods


Definition and Usage

The deferred.state() function is used to determine the current state of a Deferred object.


Note:The deferred.state() method returns a string representing the current state of the Deferred object. A Deferred object can be in one of three states:

  • "pending" :The Deferred object is in the pending state.
  • "resolved" :The Deferred object is in the resolved state, meaning that the object's deferred.resolve() or deferred.resolveWith() has been called and the doneCallbacks have been called (or are in the process of being called).
  • "rejected" :The Deferred object is in the rejected state, meaning that the object's deferred.reject() or deferred.rejectWith() has been called and the failCallbacks have been called (or are in the process of being called).


Syntax

This method does not accept any arguments.

deferred.state()


jQuery 杂项方法jQuery Miscellaneous Methods

Other Extensions