title: Cross browser AJAX function to dynamically load HTML
body: <p>I'm looking for an AJAX function to dynamically request an HTML page.  I already found the following:</p>
  
  <pre><code>function ajaxinclude(url) 
  {
     var page_request = false
  
     if (window.XMLHttpRequest) // if Mozilla, Safari etc
        page_request = new XMLHttpRequest()
     else if (window.ActiveXObject) // if IE
     { 
  
       try {
         page_request = new ActiveXObject("Msxml2.XMLHTTP")
       } 
       catch (e){
         try{
           page_request = new ActiveXObject("Microsoft.XMLHTTP")
         }
         catch (e){}
       }
     }
     else
       return false
  
     page_request.open('GET', url, false) //get page synchronously 
     page_request.send(null)
     return page_request.responseText;
   }
  </code></pre>
  
  <p>It works fine in Firefox and Chrome, but it fails in IE on the following line:</p>
  
  <pre><code>page_request.open('GET', url, false)
  </code></pre>
  
  <p>Is there a better available function that is guaranteed to be completely cross browser compatible?</p>
  
  <p><strong>Edit:</strong> Thanks for all the great suggestions... in the end, I decided not to reinvent the wheel here.  And one of the things I forgot to mention was that I also need it to update at an interval... though I had already figure that out so I didn't think it made a difference.  But then I found the great Ajax.PeriodicUpdater() Method in prototype and vastly changed my mind. I just went from a 50 LOC solution to about 4 lines :)</p>