The setup at the moment is the following:
On clicking a link, the following code is executed:
$("#main-content").load(url);
The url we're loading into main-content is mostly html, with 3 script tags at the top and 3 script tags at the bottom (that are loaded).
The code itself works fine and there are no problems locally, but once we pushed the site live and added a CDN, the Javascript started failing. After further examination it appears the scripts aren't loaded in serial by JQuery. Even though we've defined the scripts like:
<script type="text/javascript" src="a.js"></script>
<script type="text/javascript" src="b.js"></script>
<script type="text/javascript" src="c.js"></script>
a.js has a bigger latency than b.js and is evaluated later, thus producing a JS error.
I know that JQuery parses out the JS files and attaches them into the dom itself, but I thought it did this in serial. Has anyone encountered this problem before or has any idea on how to fix it?