Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Jul 2006
    Posts
    119
    Thanks
    1
    Thanked 0 Times in 0 Posts

    http request don't keep the javascripts working

    Hello
    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:
    Code:
    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;
        }
      }
      http.send(null);
    }
    anyone can help me?

  • #2
    Senior Coder shyam's Avatar
    Join Date
    Jul 2005
    Posts
    1,563
    Thanks
    2
    Thanked 163 Times in 160 Posts
    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
    You never have to change anything you got up in the middle of the night to write. -- Saul Bellow

  • #3
    Regular Coder
    Join Date
    Jul 2006
    Posts
    119
    Thanks
    1
    Thanked 0 Times in 0 Posts
    hum... i see.. can you help me a bit more? i really don't know how to search.

  • #4
    Senior Coder shyam's Avatar
    Join Date
    Jul 2005
    Posts
    1,563
    Thanks
    2
    Thanked 163 Times in 160 Posts
    the simplest way out would be to use an iframe like
    Code:
    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
    You never have to change anything you got up in the middle of the night to write. -- Saul Bellow


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •