View Full Version : http request don't keep the javascripts working

11-06-2007, 03:17 PM
I'm doing an http request of one page, and when that page loads the javascripts on that page don't work.
theres anyway to fix this?

my request code is:

function replace<?php echo $row_rs_anos['id']; ?>() {
http.open("GET", "simple_accordions_with_src/Basic.html", true);
http.onreadystatechange=function() {
if(http.readyState == 4) {
document.getElementById('foo').innerHTML = http.responseText;

anyone can help me?

11-06-2007, 04:01 PM
it won't innerHTML will only call the rendering portion of the browser and since the script tag is not something that will be part of the display it will be ignored. if u want scripts to execute u've to use DOM manipulation

11-06-2007, 04:03 PM
hum... i see.. can you help me a bit more? i really don't know how to search.

11-06-2007, 04:11 PM
the simplest way out would be to use an iframe like

document.getElementById('foo').innerHTML = '<iframe src="simple_accordions_with_src/Basic.html"><' + '/iframe>';

to learn more about html dom http://www.w3schools.com/htmldom/default.asp