Re:Multiple Simultaneous Ajax Requests (with one callback) i...
by zimbatm on Friday February 14, 2014 @10:38AM
(#7239064)
This is the proper solution: http://css-tricks.com/multiple-simultaneous-ajax-requests-on...
[ Parent
| on HN ]
Re:Multiple Simultaneous Ajax Requests (with one callback) i...
by taf2 on Friday February 14, 2014 @10:55AM
(#7239169)
$.when(
// Get the css-tricks once
$.get("http://css-tricks.com"),
// get it twice
$.get("http://css-tricks.com")
).then(function( csstricks1, csstricks2 ) {
console.log( 'Fetched css tricks' );
console.log( csstricks1, csstricks2 );
});
csstricks1[0] is the content object and usually what you'll want - for example, if the response is json.