jQuery .when multiple ajax requests, order of responses -



jQuery .when multiple ajax requests, order of responses -

per post: http://stackoverflow.com/a/17548609/985704

using jquery.when perform multiple simultaneous ajax requests.

var requests = array(); requests.push($.get('responsepage.php?data=foo')); requests.push($.get('responsepage.php?data=bar')); var defer = $.when.apply($, requests); defer.done(function(){ // executed after every ajax request has been completed $.each(arguments, function(index, responsedata){ // "responsedata" contain array of response info each specific request }); });

when requests done, can sure arguments (of $.each) in same order requests? documented somewhere? if can't sure, recommend?

per jasonp: (thank you)

yes. "the arguments passed donecallbacks provide resolved values each of deferreds, , matches order deferreds passed jquery.when()." api.jquery.com/jquery.when –

jquery ajax order .when

Comments

Popular posts from this blog

php - How to pass multiple values from url -

database - php search bar when I press submit with nothing in the search bar it shows all the data -

ios - How to load .png images from Documents folder of an app -