LAEinc. Creations Posted December 11, 2009 Share Posted December 11, 2009 alright, I am trying to work on something for my site, but I am very in-experianced with ajax. I bet what I am trying to do is simple, but I haven't had any luck with it this far I need a php/ajax file, that can constantly check a "update.txt" file, and as the .txt file changes on the server, it would automatically display the new contents of the text file on the webpage, without a required refresh. Id like to have it as real-time as possible, but without overloading any servers. Its not a chat box im wanting, its more of a real-time pagelog is what im looking for. All I really need is to be able to display the contents of a .txt file, as the .txt file changes in real time. Any Help Guys? Thank you sooo much in advanced ^^ Quote Link to comment https://forums.phpfreaks.com/topic/184726-how-to-display-contents-of-a-txt-file-live/ Share on other sites More sharing options...
.josh Posted December 11, 2009 Share Posted December 11, 2009 a million ajax tuts out there. Just c/p the ajax code onto your page, make the call to the php script. php script would be something like this: <?php echo file_get_contents('textfile.txt'); ?> use javascript's settimeout() to call the ajax function every x seconds. Quote Link to comment https://forums.phpfreaks.com/topic/184726-how-to-display-contents-of-a-txt-file-live/#findComment-975186 Share on other sites More sharing options...
LAEinc. Creations Posted December 11, 2009 Author Share Posted December 11, 2009 a million ajax tuts out there. Just c/p the ajax code onto your page, make the call to the php script. php script would be something like this: <?php echo file_get_contents('textfile.txt'); ?> use javascript's settimeout() to call the ajax function every x seconds. I know 0 javascript and ajax, I am decent in PHP as of now though. Thank you for your fast reply, too Quote Link to comment https://forums.phpfreaks.com/topic/184726-how-to-display-contents-of-a-txt-file-live/#findComment-975187 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.