Hi,
I’m using YUI (asynchronous) and putting the response of my posted data in a div which is in the body of the HTML:
div.innerHTML = o.responseText;
However the javascript inside the responseText is not getting executed.
I have tried using the bubbling dispatcher plugin but this just removes the <script tags and the code inside the <script tags when I view the html source.
Instead I tried this bit of code passing in my div:
function evalScript(div) {
var x = div.getElementsByTagName(“script”);
var scriptBlocks = [];
for(var i=0; i<x.length; i++) {
var oScript = document.createElement(‘script’);
oScript.text = x[i].text;
scriptBlocks[i] = oScript;
}
for(var i=0; i <scriptBlocks.length; i++) {
div.appendChild(scriptBlocks[i]);
}
}
and this runs all the <script> //some code </script> tags in the div however it is not running any of the included scripts where I have lines like this:
<script type=”text/javascript” src=”aScriptFile.js”></script>
it just isn’t calling the file. I know the .js file(s) are ok because if I put them in the head of the HTML they do execute but I want to include these files dynamically in the body.
Any help would be great.
Thx