What are deferred and promise object in jQuery?

A deferred object is an object than can create a promise and change its state to resolved or rejected. It is used to register multiple callbacks into callback queues, invoke callback queues, and relay the success or failure state of any synchronous or asynchronous function. A promise is, as the name says, a promise about a future value. Together with the Promise object , Deferred represents the jQuery implementation of promises. You can attach callbacks to it to get that value. It possesses a subset of the methods of the Deferred object : always(), done(), fail(), state(), and then().


You cannot use $.Promise(); because it does not exist. The deferred.promise() method allows an asynchronous function to prevent other code from interfering with the progress or status of its internal request.