jQuery deferred.resolve() Method

Last Updated:

jQuery deferred.resolve() Method

The jQuery deferred.resolve() method resolves a Deferred object and call any doneCallbacks with the given arguments.

Example

HTML Editor
<!DOCTYPE html> <html lang="en-US"> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> </head> <body> <h1>jQuery deferred.resolve() Method</h1> <button>resolve</button> <script> $(document).ready(function(){ $("button").click(function(){ var deferred = $.Deferred(); deferred.then(function(value) { alert(value); return 42; }).then(function(id){ alert('The answer : ' + id); }); deferred.resolve("hello world"); }); }); </script> </body> </html>

Syntax

deferred.resolve(args);

Parameter Values

Value Type Explanation
args Optional Specifies the arguments that are passed to the doneCallbacks.

Browser Support

Devicedesktopmobile
Browsergoogle chromesafarifirefoxinternet Exploreredgeoperagoogle chromesafarifirefoxedgeoperaandroid webviewsamsung internet
deferred.resolve()YesYesYesYesYesYesYesYesYesYesYesYesYes

Share this Page

Meet the Author