title: how to run javascript in html loaded via ajax
body: <p>I have an index.php file that loads other php files via this javascript/ajax code: </p>
  
  <pre><code>function AJAX(elementID,url,showStatus){
  var httpObject;
  if (window.ActiveXObject) {
      httpObject = new ActiveXObject("Microsoft.XMLHTTP");
  }
  if (window.XMLHttpRequest){
      httpObject =  new XMLHttpRequest();
  }
  else {
      alert("Your browser does not support AJAX.");       
  }
  
  if (httpObject != null) {
      httpObject.onreadystatechange = function() {          
          if (elementID != false){                
  
              if (httpObject.readyState == 4 &amp;&amp; httpObject.status == 200) {                  
                  document.getElementById(elementID).innerHTML= httpObject.responseText;  
  
              } 
          }
  
      }
  
      httpObject.open("POST",url,true);
      httpObject.send(null);  
  }
  }
  </code></pre>
  
  <p>so for example I would load a file in inxex.php by:</p>
  
  <pre><code>&lt;script&gt;
  AJAX("updateThisDiv", "/includes/contentpage.php", false)
  &lt;/script&gt;
  </code></pre>
  
  <p>which would paste the contents of "contentpage.php" into the div "updateThisDiv" but now if I have any javascript on "contentpage.php", it will not run, is there any way to do this?</p>
  
  <p>I have looked at this: <a href="http://www.javascriptkit.com/script/script2/ajaxpagefetcher.shtml" rel="nofollow">http://www.javascriptkit.com/script/script2/ajaxpagefetcher.shtml</a>
  but its not exatcly what I was looking for.</p>
  
  <p>I want to be able to update a section of my page without reloading the entire page and javascript must run</p>