Multiple Simultaneous Ajax Requests (with one callback) in jQuery | CSS-Tricks

"Let’s say there is a feature on your website that only gets used 5% of the time. That feature requires some HTML, CSS, and JavaScript to work. So you decide that instead of having that HTML, CSS, and JavaScript on the page directly, you’re going to Ajax that stuff in when the feature is about to be used.

We’ll need to make three Ajax requests. Since we don’t want to show anything to the user until the feature is ready to go (plus they all kinda rely on each other to work right) we need to wait for all three of them to be complete before proceeding.

What’s the best way to do that?"