I am adding a JavaScript file to my site (using appendChild) in an Ajax calls oncomplete. After that I am trying to call a function that is included in that file. Like this:
// append the JS to the head
document.getElementsByTagName('head')[0].appendChild(element);
// call a function that is contained in the js file
myFunction();
The call to myFunction says "myFunction() is not defined". The question is, how do I know when it is defined?
Thanks!