Skip to content

Instantly share code, notes, and snippets.

@contolini
Last active August 29, 2015 14:08
Show Gist options
  • Save contolini/3a7f66ab19aa1a7d4773 to your computer and use it in GitHub Desktop.
Save contolini/3a7f66ab19aa1a7d4773 to your computer and use it in GitHub Desktop.
function one( foo ){
return $.ajax({
url: foo
});
}
function two( bar ){
return $.ajax({
url: bar
});
}
$.when( one('some-data.json'), two('other-data.json') ).done(function( dataFromFunctionOne, dataFromFunctionTwo ){
console.log( 'stuff from two XHR:' + dataFromFunctionOne + dataFromFunctionTwo );
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment