I have a doubt about the sequential order of execution of javascript in a special case, as follows.
A js file (main.js
) included in the head of my page sometimes needs to include another js file dynamically, like:
document.write('<script src="userdata.js"></script>');
Within this second file is defined a variable xmlFix
However, if I try to reference this variable later on in main.js, it fails. Why? When is userdata.js
executed?