After a click event on the page, I use ajax to retrieve a block of html and script. Although I can successfully append the script element to the head element, WebKit based browsers are not recognizing it as a script (meaning I am unable to call a function defined in the appended script).
When examining the Chrome Developer Tools, I noticed that the dynamic script node appears different from a non-dynamic one. A non-dynamic script has a text child element which I have been struggling to replicate for the dynamic script.
Are there any suggestions or more effective ways to achieve this? My main goal is to avoid loading unnecessary html and script until a user clicks on a specific tab, at which point the relevant content (including script) would be loaded. Thank you!