I am currently using the following script to refresh my messages.php in a div with a timeinterval of 60 seconds.
<script> jQuery().ready(function(){ setInterval("getResult()",60000); }); function getResult(){ jQuery.post("messages.php",function( data ) { jQuery("#msgs").html(data); }); } </script> <div id="msgs"> </div> My current problem is that the echo of the php file displays for the first time after the 60 seconds passed. Then it refreshes every 60 seconds. I need to get the code to load at the start of launching the page.
jQuery(getResult);would call it once document is ready. FYI, this is preferred syntax:setInterval(getResult, 60000);avoiding string evaluation