Suppose I have this code:
my_script_data = document.getElementById("id_php_defer__core");
if (my_script_data == undefined) {
Alert(request.responseText); // all looks good!
my_script_data = document.createElement("script");
my_script_data.setAttribute("id", "id_php_defer__core");
my_script_data.innerHTML = 'function myinitfunc() { ' + "\n" + request.responseText + "\n" + ' }';
to = document.head;
if (to != undefined) {
to.appendChild(my_script_data);
}
}
else {
Alert(request.responseText); // all looks good!
my_script_data.innerHTML = 'function myinitfunc() { ' + "\n" + request.responseText + "\n" + ' }';
eval(my_script_data.innerHTML);
}
The "request.responseText" is actually a Javascript array declaration with lots of values set.
After above code, the "myinitfunc" is called later.
(And as it should only contain "request.responseText" the global (!) array of values should be updated.)
However, while the code works on first run, subsequent runs seem to do nothing, so I am doing something wrong, but what? :)