YouTip LogoYouTip

Misc Deferred Resolvewith

# jQuery deferred.resolveWith() Method [![Image 3: jQuery Misc Methods](#)jQuery Misc Methods](#) * * * ## Definition and Usage The `deferred.resolveWith()` function is used to resolve a Deferred object and call any `doneCallbacks` with a given `context` and `args`. **Note:** 1. Usually, only the creator of the deferred object can call this method. You can prevent other code from changing the deferred object's state or reporting its state by calling `deferred.promise()`, which returns a restricted Promise object. 2. When the deferred object is resolved, any `doneCallbacks` added via `deferred.then` or `deferred.done` will be called. Callback functions are executed in the order they were added. The `args` parameter passed to `deferred.resolve()` is passed to each callback function. Once the deferred object enters the resolved state, any `doneCallbacks` added will be executed immediately, with the arguments passed to `.resolve()`. * * * ## Syntax deferred.resolveWith( context [, args ] ) | Parameter | Description | | :--- | :--- | | _context_ | Object type. The `this` object passed to the `doneCallbacks` callback functions. | | _args_ | Array type. An optional array of arguments passed to the `doneCallbacks` callback functions. | * * jQuery Misc Methods](#)
← Misc Jquery SubMisc Deferred Promise β†’