basketmen Posted May 7, 2012 Share Posted May 7, 2012 I have a php file lets say file1.php, that printing a variable, its dynamic numbers output that already always increasing, like private message numbers that coming or others : <?php echo $variable ?> i want to put that variable output, in another files page title, lets say file2.php or file3.html, in the front of the another files page titles, and auto refresh every x seconds, maybe like this : (1) - another text in the page title after x seconds, get a private message (2) - another text in the page title after another x seconds, get another private message (3) - another text in the page title or its ok if just like this, only the variable, without the another text in the page title (1) please share your knowledge to make it, maybe using javascript, jquery or others Quote Link to comment https://forums.phpfreaks.com/topic/262191-how-to-make-page-title-auto-refresh-every-x-seconds-using-javascriptjqueryothers/ Share on other sites More sharing options...
Adam Posted May 8, 2012 Share Posted May 8, 2012 You need to use AJAX to poll the server every x amount of seconds for new messages, then update the value of the JavaScript document.title property. The jQuery documentation has plenty of AJAX examples, but if you get stuck post your progress and we'll give you a hand. Edit I'm not too sure what you were referring to with the access across different files, but you shouldn't be refreshing the page. That will annoy your users immensely! As I said, use a client-side scripting (JS) to poll the server for the updated number and dynamically change it. Quote Link to comment https://forums.phpfreaks.com/topic/262191-how-to-make-page-title-auto-refresh-every-x-seconds-using-javascriptjqueryothers/#findComment-1343957 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.