JQuery deferred.resolve() method Last Updated : 07 Aug, 2024 Comments Improve Suggest changes Like Article Like Report This deferred.resolve() method in JQuery is used to resolve a Deferred object and call any doneCallbacks with the given arguments. Syntaxdeferred.resolve([args])Parametersargs: This is optional parameters and is arguments which are passed to the doneCallbacks. Return ValueThis method returns the deferred object. There are two examples discussed below: Example: In this example, The resolve() is called with the arguments. HTML <!DOCTYPE HTML> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content= "width=device-width, initial-scale=1.0"> <title>JQuery | deferred.resolve() method</title> <script src="https://code.jquery.com/jquery-3.5.0.js"></script> <style> body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background-color: #f8f9fa; margin: 0; display: flex; justify-content: center; align-items: center; height: 100vh; color: #343a40; text-align: center; } .container { background: #ffffff; padding: 30px; border-radius: 12px; box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1); max-width: 600px; width: 90%; } h1 { color: #28a745; margin-bottom: 20px; } p { font-size: 1.1em; line-height: 1.6; color: #495057; transition: color 0.3s ease; } button { padding: 10px 20px; font-size: 1em; color: #ffffff; background-color: #007bff; border: none; border-radius: 5px; cursor: pointer; transition: background-color 0.3s ease; } button:hover { background-color: #0056b3; } footer { margin-top: 20px; font-size: 0.9em; color: #28a745; } </style> </head> <body> <div class="container"> <h1>GeeksForGeeks</h1> <p id="GFG_UP">JQuery | deferred.resolve() method</p> <button id="clickBtn">Click here</button> <p id="GFG_DOWN"></p> <footer>© 2024 GeeksforGeeks. All rights reserved.</footer> </div> <script> $(document).ready(function(){ $('#clickBtn').on('click', function(){ var def = $.Deferred(); def.done(function(val, div){ $(div).append(val); }); def.resolve( 'resolve() method is called with arguments and Deferred object is resolved', '#GFG_DOWN' ); }); }); </script> </body> </html> OutputOutput : deferred.resolve() method Comment More infoAdvertise with us Next Article JQuery deferred.resolve() method P PranchalKatiyar Follow Improve Article Tags : JavaScript Web Technologies JQuery jQuery-Methods Similar Reads jQuery deferred.resolveWith() Method This deferred.resolveWith() method in jQuery is used to resolve a Deferred object and call the doneCallbacks along with the given context and arguments. Syntaxdeferred.resolveWith(context[, args])Parameterscontext: The context passed to the doneCallbacks as the 'this' object. args: It is an optional 2 min read jQuery deferred.reject() Method The deferred.reject() method in jQuery is used to reject a Deferred object and call any failCallbacks with the given arguments.Syntax:deferred.reject( [args] )Parameters:args: It is an optional parameter that are passed to the failCallbacks.Return Value: This method returns the deferred object.Examp 1 min read jQuery Deferred .promise() method This .promise() method in JQuery Returns a Promise object to be observed when certain type actions bounded to the collection, queued or not, are ended.Syntax:.promise([type][, target])Parameters:type: This parameter specifies the type of queue which needed to be observed. target: This parameter spec 2 min read JQuery deferred.state() method This deferred.state() method in JQuery is used to determine the current state of a Deferred object. Syntax: deferred.state()Return Value: This method returns the state of deferred object. There are two examples discussed below: Example: In this example, the state of deferred object 'def' is pending. 2 min read JQuery .Deferred() method This JQuery.Deferred() method in JQuery is a function which returns the utility object with methods which can register multiple callbacks to queues. It calls the callback queues, and relay the success or failure state of any synchronous or asynchronous function.Syntax:jQuery.Deferred([beforeStart])P 2 min read Like