title: XMLHttpRequest to read an external file
body: <p>I want to retrieve the data contained in a text file (from a given URL) through JavaScript (running on the client's browser).</p>
  
  <p>So far, I've tried the following approach:</p>
  
  <pre><code>var xmlhttp, text;
  xmlhttp = new XMLHttpRequest();
  xmlhttp.open('GET', 'http://www.example.com/file.txt', false);
  xmlhttp.send();
  text = xmlhttp.responseText;
  </code></pre>
  
  <p>But it only works for Firefox. Does anyone have any suggestions to make this work in every browser?</p>
  
  <p>Thanks</p>