TheUkSniper Posted April 3, 2006 Share Posted April 3, 2006 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 Link to comment Share on other sites More sharing options...
DrDre Posted April 3, 2006 Share Posted April 3, 2006 [!--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. Quote Link to comment Share on other sites More sharing options...
TheUkSniper Posted April 3, 2006 Author Share Posted April 3, 2006 got the ebook on learning ajax.. not read it yet tho but im not sure tht ajax can refresh results on a time limit Quote Link to comment Share on other sites More sharing options...
Guest footballkid4 Posted April 4, 2006 Share Posted April 4, 2006 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. Quote Link to comment Share on other sites More sharing options...
DrDre Posted April 4, 2006 Share Posted April 4, 2006 [code]<script>function Update() { //your ajax code setTimeout("Update()",5000);}Update();</script>[/code]That will make it Update every 5 seconds. Quote Link to comment Share on other sites More sharing options...
TheUkSniper Posted April 5, 2006 Author Share Posted April 5, 2006 currently i got thisPage2.php - this is the main page and has the iframe for Page3.phpPage3.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.phphow 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 filesthanx Quote Link to comment 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.