almightyegg Posted August 8, 2007 Share Posted August 8, 2007 I waswondering how I would make a certain part of the page update every second, to check whether new messages are in the database. I know how I can post messages to the database without refreshing, but it's just showing them afterwards without a page reload that I can't do. Can anyone point me to a tutorial or help with it temselves? TY in advance Quote Link to comment Share on other sites More sharing options...
adam84 Posted August 14, 2007 Share Posted August 14, 2007 Probably the only way of doing this is using the Javascript to run a function every 1sec, then have the JS function use ajax to call a php file which you can check to see if there is any new update. Then load whatever you found into a div or span tag on your page. JS file function checkMessages(){ sendRequest('checkNewMessages.php','newMessages'); setTimeout("checkMessages", 1000); // Param 1 = "checkMessages" will call this function // Param 2 = 1000 milli = 1 sec } PHP FILE do whatever you need to do 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.