I have this code:
$(document).ready(function() {
window.addEventListener('DOMContentLoaded', function() {
var s = d.createElement('script');
s.async = false;
s.src = 'file.js';
s.id = 'script';
d.body.appendChild(s);
});
});
$(window).load(function() {
workwithvariablesInfilejs();
});
It seems that the document.ready fires first and window.load fires after. But if try to access the variables of the file.js I have troubles because it seems that the file.js script loads after window.load. How can I wait until the file.js is loaded ? Or is there a better way to organize this code?