Created
February 18, 2012 23:53
-
-
Save mkempe/1861348 to your computer and use it in GitHub Desktop.
Multiple Ajax request with jQuery
This file contains hidden or 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
var queue = []; | |
$.each(foobars, function(i, foobar) { // Built up queue | |
queue.push($.getJSON( | |
'http://foobar.com/foo.js', // URL | |
{ foo: foobar.bar }, // Params | |
function(data) { // Callback | |
# ... | |
)); | |
}); | |
$.when.apply($, queue).done(function() { | |
console.log('Woot!'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment