Created
February 19, 2014 20:46
-
-
Save pbojinov/9101153 to your computer and use it in GitHub Desktop.
Multiple Simultaneous Ajax Requests (with one callback) in jQuery
This file contains 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
// http://css-tricks.com/multiple-simultaneous-ajax-requests-one-callback-jquery/?utm_source=javascriptweekly&utm_medium=email | |
$.when( | |
// Get the HTML | |
$.get("/feature/", function(html) { | |
globalStore.html = html; | |
}), | |
// Get the CSS | |
$.get("/assets/feature.css", function(css) { | |
globalStore.css = css; | |
}), | |
// Get the JS | |
$.getScript("/assets/feature.js") | |
).then(function() { | |
// All is ready now, so... | |
//globalstore.css | |
//globalstore.html | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment