Hey team,
I need a function like the jquery getscript() function in Dom7… I just don’t wanna include jquery as a separate script just to use one function… I have an online script that I want to use at a certain page otherwise I don’t load it… Reason is: I have realised that loading it in the tags, if the connection is slow, the app has a problem in starting up… It’s the online scripts causing that…
I tried to create append the script tags with it into the head tags in the from the specific component pageInit, It appends it, when I check the elements in the console but I can’t use the functions of the script because they are not in the Dom, or loaded (I don’t know) saying they ain’t undefined…
function LoadAlgoriaAPI() { var script = document.createElement("script"); script.src = "some-script.js"; script.type = "text/javascript"; document.getElementsByTagName("head")[0].appendChild(script); }