Jump to content

Recommended Posts

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 ^^

 

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.

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 :)

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.