jQuery Deferreds and the jQuery Promise Method
jqXHR and the Promise Interface
jQuery 1.5 features a brand new mechanism for dealing with asynchronous event-driven processing. This system, called deferreds, was first implemented for jQuery’s $.ajax method and so we’ll be looking closely at that method.
$.ajax({
url: "/some/url",
success: function(r){
alert("Success: " + r);
},
error: function(r){
alert('Error: ' + r);
}
});