title: Create a loop for read a text file or real time changes
body: <p>So, what I did it's to collect an information from a text file, and then transform that into text on the html page. Here's the code:</p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;div id="text" class="text"&gt;&lt;/div&gt;
  </code></pre>
  
  <p>JavaScript:</p>
  
  <pre><code>var text_print = new XMLHttpRequest();
          text_print.open("GET", "file.txt", true);
          text_print.onload = function (){
          document.getElementById("text").innerHTML=text_print.responseText;
          text_print.send(null);
  </code></pre>
  
  <p>What I need to do now, it's to make this script run every second.<br>
  The <code>file.txt</code> in my server changes constantly, so I need that the information printed on screen change when the file changes.<br>
  Thank you.</p>