Skip to content

Instantly share code, notes, and snippets.

@ericglasser
Created October 30, 2013 17:07
Show Gist options
  • Save ericglasser/7236300 to your computer and use it in GitHub Desktop.
Save ericglasser/7236300 to your computer and use it in GitHub Desktop.
A Pen by Secret Sam.
<div id='test-div'>
test data
</div>
var test1 = $.Deferred();
var test2 = $.Deferred();
var test1Promise = test1.promise();
var test2Promise = test2.promise();
setTimeout(function () {
test2.resolve('test1');
},200);
setTimeout(function () {
test2.resolve('test2');
},300);
$.when(test1Promise, test2Promise).then(function (test1, test2) {
alert(test1);
alert(test2);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment