title: Running javascript in a page loaded by xmlhttprequest
body: <p>In my javascript method I'm calling a xmlhttprequest to grab some data and display it in a div called 'myDiv' (index.php)</p>
  
  <pre><code>function combo_change(theid)
  {
    if (window.XMLHttpRequest)
    { // code for IE7+, Firefox, Chrome, Opera, Safari
      xmlhttp=new XMLHttpRequest();
    }
    else
    { // code for IE6, IE5
      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  
    xmlhttp.onreadystatechange=function()
    {
      if(xmlhttp.readyState == 4 &amp;&amp; xmlhttp.status == 200)
      {
        document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
      }
    }
    xmlhttp.open("GET","anotherpage.php?id=" + theid,true);
    xmlhttp.send();
  }
  </code></pre>
  
  <p>Now, I'm trying to call some javascript within the page "anotherpage.php", but it does not want to work. As a test I'm just doing a <code>document.write('hello');</code>. If I load the page directly it will show, but when using the code via xmlhttp open it will not.</p>
  
  <p>I can assume that when loading like this, the javascript is not being run. So, is there anyway I can make it run?</p>