jQuery deferred.reject() Method Last Updated : 23 Jul, 2024 Comments Improve Suggest changes Like Article Like Report 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.Example 1: In this example, the reject() method is called with the arguments. html <!DOCTYPE HTML> <html> <head> <script src= "https://code.jquery.com/jquery-3.5.0.js"> </script> </head> <body style="text-align:center;"> <h1 style="color:green;"> GeeksForGeeks </h1> <p> jQuery | deferred.reject() method </p> <button onclick="Geeks();"> click here </button> <p id="GFG"></p> <script> function Func(val, div) { $(div).append(val); } function Geeks() { var def = $.Deferred(); def.fail(Func); def.progress(Func); def.reject('reject() method is ' + 'called with arguments and' + ' Deferred object is ' + 'rejected', '#GFG') } </script> </body> </html> Output:Example 2: In this example, the reject() method is called without arguments. html <!DOCTYPE HTML> <html> <head> <script src= "https://code.jquery.com/jquery-3.5.0.js"> </script> </head> <body style="text-align:center;"> <h1 style="color:green;"> GeeksForGeeks </h1> <p> JQuery | deferred.reject() method </p> <button onclick="Geeks();"> click here </button> <p id="GFG"></p> <script> function Func() { $('#GFG').append ("reject() method is called " + "without arguments and " + "Deferred object is rejected"); } function Geeks() { var def = $.Deferred(); def.fail(Func); def.progress(Func); def.reject() } </script> </body> </html> Output: Comment More infoAdvertise with us Next Article jQuery deferred.reject() Method P PranchalKatiyar Follow Improve Article Tags : JavaScript Web Technologies JQuery jQuery-Methods Similar Reads jQuery deferred.rejectWith() Method This deferred.rejectWith() method in jQuery is used to reject a Deferred object and call the failCallbacks along with the given context and arguments. Syntax: deferred.rejectWith(context[, args])Parameters: context: This parameter is the context passed to the failCallbacks as the 'this' object. args 2 min read JQuery deferred.resolve() method 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 def 2 min read JQuery deferred.pipe() Method The deferred.pipe() method in jQuery is used to add utility method to filter, chain Deferreds.Syntax:deferred.pipe([doneFilter][, failFilter][, progressFilter])Parameters: This method accepts three parameter as mentioned above and described below:doneFilter: It is an optional function which is calle 2 min read JQuery deferred.then() method This deferred.then() method in JQuery is used to add handlers which are to be called when the Deferred object is resolved, rejected, or in progress. Syntax: deferred.then(doneCallbacks[, failCallbacks][, progressCallbacks])Parameters: doneCallbacks: This is a function, or an array of functions, whic 3 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