We are currently facing an issue in our project where AJAX returns some code, and we utilize innerHTML to insert this code into a DIV.
Subsequently, we scan this DIV for all script tags and execute the contents of these script tags using EVAL() (which adds information to a global array, etc).
scriptTags = responseElement.getElementsByTagName("script");
for (i = 0; i < scriptTags.length; i++) {
eval(scriptTags[i].text);
}
This process functions flawlessly in Firefox and Chrome. However, in Internet Explorer, scriptTags seems to be empty. Further investigation reveals that the innerHTML of the responseElement lacks any SCRIPT tags (while they exist in Firefox / Chrome).
Does anyone have insights on the cause and/or a workaround for this issue?
Just for reference, here is how I place the AJAX response on the page:
this.proxy.innerHTML = o.responseText;
scriptTags = this.proxy.getElementsByTagName("script");
When debugging o.responseText, the SCRIPT tags are present within the response. Despite this, when checking the this.proxy element on the page, there are no SCRIPT tags visible in IE, while they do show up in Firefox and Chrome.