title: Get value from text file in javascript
body: <p>I have a javascript variable which I display on my html website, I also have a .txt file which gets a payment value from a .php script. These values are displayed like this 12345 in the .txt file, every amount is raised by 1, so first the .txt file gets 1 then 2 then 3 etc. Now my question is, how do I get the last value from the .txt file and turn my variable value into the value I get, by the last value of the .txt file I mean if the current values in the file is 12345 then the last value is 5, then I want to change the variable in my Javascript to that value 5.</p>
  
  <p>My javascript/html script with the variable and display inside.</p>
  
  <pre><code>&lt;div class="newValue"&gt;
          Current value: $&lt;span id="newValueVariable"&gt;&lt;/span&gt;
  &lt;/div&gt;
  
   &lt;script type="text/javascript"&gt; 
  
          var newValueVariable= 1;
          document.getElementById("newValueVariable").innerHTML = newValueVariable;
  
  &lt;/script&gt;
  </code></pre>