tags:

views:

52

answers:

4

Hi Every two minutes i want to check whether i received some message so want to reload my page every 2 minutes how to reload my php page using javascript

A: 

Quick and dirty:

setTimeout( function() {
    location.reload()
}, 120000);

Though I think there could possibly be a fancier way of doing this, this is just what I know though.

meder
A: 

I recommend looking into doing it with ajax. Look at the jQuery library, or any of the JavaScript libraries.

http://jquery.com/

mikelbring
+2  A: 
<body onload="setInterval('window.location.reload()', 120000);">
Babiker
+3  A: 

Why are you sticking on javascript. You can do this without Javascript too. <meta http-equiv="refresh" content="2;url=http://path/to/the/page" />

Hi Its working good is there any advantage of using this in meta tag instead of using in javascript
udaya
If the user has javascript disabled this will continue to work :)
AntonioCS