Run multiple AJAX requests in parallel

Some times it is best idea to issue multiple Ajax request in parallel. Without waiting one request to be completed we can issue multiple request using jquery when method


$.when($.get('files/1.json'), $.get('files/2.json')).then(function(r1, r2){
log(r1[0].message + " " + r2[0].message);
});

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s