jquery - Javascript AJAX insert value -


so making site shows value of .txt file, got far:

<script> $(document).ready(function() {  $("#responsecontainer").load("info.txt");  var refreshid = setinterval(function() {   $("#responsecontainer").load('info.txt');  }, 1000);  $.ajaxsetup({ cache: false }); }); </script> 

so get's string info.txt , puts inside div resonsecontainer.

but want same string in value of meter, , auto updater that. code is:

<meter id="cpumeter" value="60" min="0" max="120.47" title="gb"> <div class="meter-gauge"> <span style="width: 46.42%;"></span> </div> </meter>   

how autoupdate value="60" string of info.txt?

thanks!

you can give callback argument .load(), , receive contents of file.

$(document).ready(function() {     function loadinfo() {         $("#responsecontainer").load('info.txt', function(info) {             $("#cpumeter").val(parsefloat(info));         });     }     $.ajaxsetup({ cache: false });     loadinfo();     var refreshid = setinterval(loadinfo, 1000); }); 

Comments

Popular posts from this blog

php - Zend Framework / Skeleton-Application / Composer install issue -

c# - Better 64-bit byte array hash -

python - PyCharm Type error Message -