Skip to content Skip to sidebar Skip to footer

How To Read Live Streaming Data Using Ajax

I want to read live streaming data from my URL(ie.http://..) My URL(ie.http://..) contain numeric data and it's continuously growing. i want to read that data in to my file(HTML5

Solution 1:

If you check for xmlhttp.readyState == 3 (XMLHttpRequest.LOADING), then accessing xmlhttp.responseText will give you the data that has been received from your server so far. You can then use a setInterval to constantly check xmlhttp.responseText for new data.

Solution 2:

Try this script to get stream your data... but you need jquery.js file in your directory and StaticDemoData.txt you can change with other file in .php extension and get your query on the file

<html><head><scripttype="text/javascript"src="jquery-1.5.1.js"></script><scripttype="text/javascript">
$(document).ready(function(){
  userdetails();
});


functionuserdetails(){
     $.post('StaticDemoData.txt',function(data){
         $('.result').html(data);
       });     

       setTimeout("userdetails()",1000);
}

</script></head><body><divclass="result"></div></body></html>

Post a Comment for "How To Read Live Streaming Data Using Ajax"