jQuery deferred.resolveWith() method
Definition and Usage
The deferred.resolveWith() function is used to resolve a Deferred object and call any doneCallbacks with the given context and args.
**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 resolved, any doneCallbacks added via deferred.then or deferred.done are called. The callbacks are executed in the order in which they were added. The args passed to deferred.resolve() are passed to each callback. After the deferred object enters the resolved state, any doneCallbacks added afterwards are executed immediately with the arguments passed to .resolve().
Syntax
deferred.resolveWith( context [, args ] )
| Parameters | Description |
|---|---|
| context | Object type: Passed as the this object to the doneCallbacks |
| args | Array type: An optional array of arguments passed to the oneCallbacks |
jQuery Miscellaneous Methods