Jump to content

Archived

This topic is now archived and is closed to further replies.

TheUkSniper

Auto reloading script

Recommended Posts

i have got a php script i want to reload every 5 seconds when someone is on it... i currently have it in a hidden IFRAME but on each refresh u get tht clicking noise... is there anyway to either stop the clicking noise or to get php to reload without taking the user refreshing the page they are on (dont think this is possible)
thanks :)

Share this post


Link to post
Share on other sites
[!--quoteo(post=361366:date=Apr 3 2006, 05:58 PM:name=TheUkSniper)--][div class=\'quotetop\']QUOTE(TheUkSniper @ Apr 3 2006, 05:58 PM) [snapback]361366[/snapback][/div][div class=\'quotemain\'][!--quotec--]
i have got a php script i want to reload every 5 seconds when someone is on it... i currently have it in a hidden IFRAME but on each refresh u get tht clicking noise... is there anyway to either stop the clicking noise or to get php to reload without taking the user refreshing the page they are on (dont think this is possible)
thanks :)
[/quote]
[a href=\"http://w3schools.com/ajax/default.asp\" target=\"_blank\"]http://w3schools.com/ajax/default.asp[/a]

Thatll do exactly as you want.

Share this post


Link to post
Share on other sites
got the ebook on learning ajax.. not read it yet tho but im not sure tht ajax can refresh results on a time limit

Share this post


Link to post
Share on other sites
Guest footballkid4
The benefit of using AJAX is to send a request to the page to see if the data has changed at all. If the data has changed, then you can reload the page...otherwise you don't reload it. Then you don't have the page reloading every 5 seconds...only when the data has changed.

Share this post


Link to post
Share on other sites
[code]<script>
function Update() {
  //your ajax code
  setTimeout("Update()",5000);
}
Update();
</script>[/code]

That will make it Update every 5 seconds.

Share this post


Link to post
Share on other sites
currently i got this

Page2.php - this is the main page and has the iframe for Page3.php

Page3.php - autorefreshes every 5 seconds, looks up the database and checks whether the database says the pages is locked (0) or open (1). If its locked, it will take over Page2.php via js changing the page to Lock.php


how would i go about doing this with AJAX... am i right by thinking i need to create a php file that checks the database to see if the page is locked and echo's either 1 or 0... then the Page2.php must contain some AJAX script to read the php file and then will change the pages location if the php file echos 0... if it is.. any one got any idea where to find some AJAX code to do this cus the parts i found just use text and html files

thanx

Share this post


Link to post
Share on other sites

×

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.