| Start |
|---|
| jQuery ajax() success, error VS .done(), .fail() success and Error : A success callback that gets invoked upon successful completion of an Ajax request. A failure callback that gets invoked in case there is any error while making the request. Example: .done() and .fail() : .ajax().done(function(data, textStatus, jqXHR){}); Replaces method .success() which was deprecated in jQuery 1.8.This is an alternative construct for the success callback function above. .ajax().fail(function(jqXHR, textStatus, errorThrown){}); Replaces method .error() which was deprecated in jQuery 1.8.This is an alternative construct for the complete callback function above. Example: |
| Basic promise creation Here is a very simple example of a function that "promises to proceed when a given time elapses". It does that by creating a new And use like this: |
| Get the current state of a promise By default the state of a promise is pending when it is created. The state of a promise is changed when the deferred object which created the promise either resolves/rejects it. |
| Asynchronous Promises Chaining If you have multiple asynchronous tasks that needs to occur one after the other, you will need to chain together their promise objects. Here is a simple example: |
Read Article
https://develop.horje.com/learn/1434/reference