Created
December 9, 2014 01:39
-
-
Save devdays/258ac5626a910da12f6e to your computer and use it in GitHub Desktop.
Object JavaScript - Deferred in jQuery
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('#result').html('waiting...'); | |
var pro = wait(); | |
pro.done(result); | |
function result() { | |
$('#result').html('done'); | |
} | |
function wait() { | |
var deferred = $.Deferred(); | |
setTimeout(function() { | |
deferred.resolve(); | |
}, 2000); | |
return deferred.promise(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment