javascript - Get value from txt file -


i have txt file add value later on .php script, looking way latest value txt file using javascript, lets lates value has been added , 3, wan't javascript value , turn variable in script value.

example of how txt file look. 1 2 3

and because 3 lates value added, javascript variable , turn variable.

so let's javascript file looks this

<script type="text/javascript">                       var nrvalue= 1;                     document.getelementbyid("nrvalue").innerhtml = nrvalue;                     document.getelementbyid("nrvalue").value = nrvalue;                  </script> 

i wan't javascript function turn nrvalue latest updated value txt file.

you can load .txt file ajax call , process data in result. this:

jquery.get('file.txt', function(data) {    // type o breaking line caracter vary depending on os    var values = data.split("\n");           var lastvalue = values[values.length-1];               }); 

Comments

Popular posts from this blog

cakephp - simple blog with croogo -

How to group boxplot outliers in gnuplot -

bash - Performing variable substitution in a string -