On a specific event, I need to load an additional javascript file and, after downloading and executing it, perform some kind of action. According to the task, I cannot enter any code in the loaded script (maybe a third-party developer or from a CDN, for example)
The first part of the task I do as follows
var mscript = document.createElement("SCRIPT"); var head = document.getElementsByTagName( "head" )[ 0 ]; mscript.type = "text/javascript"; mscript.src = 'http://somesite.ru/script.js'; head.appendChild(mscript); Is there any event that allows you to perform an action after loading and executing the script. (I am currently using a timeout). If necessary, you can use jquery for the solution.
onloadat the script element - Grundy