Skip to content

Instantly share code, notes, and snippets.

@yagopv
Created June 25, 2013 11:50
Show Gist options
  • Save yagopv/5857888 to your computer and use it in GitHub Desktop.
Save yagopv/5857888 to your computer and use it in GitHub Desktop.
Deferred object
var a = $.Deferred(function(dfd) {
setTimeout(function() {
//dfd.resolve();
dfd.reject();
},5000);
}).promise();
a.then(function() {
alert("success");
}).fail(function() {
alert("error");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment