matthew9090 Posted April 14, 2011 Share Posted April 14, 2011 ive looked at loads of codes but none work. i am trying to refresh the resource count (for a browser game). my overview page includes all the files so it looks like this: <?php include 'global.php'; if (isset($_SESSION['user'])) { $username = $_SESSION['user']; include('inc/calculateres.php'); include('inc/showname.php'); echo "<hr><div id='refresh'>"; include('inc/showres.php');//need to refresh this line<<<<<<< echo "</div><p>"; include('inc/resph.php'); echo "<p>"; include('inc/showbuildings.php'); } else { header("location: login.php"); } ?> i need to refresh the div and the showres.php include every 2 seconds so you dont have to refresh the page manually. please help me! Quote Link to comment https://forums.phpfreaks.com/topic/233723-refresh-page-help/ Share on other sites More sharing options...
phpsycho Posted April 15, 2011 Share Posted April 15, 2011 This little snippet of code should help ya out <script src="http://code.jquery.com/jquery-latest.js"></script> <script> var refreshId = setInterval(function() { $('#showres').fadeOut("slow").load('inc/showres.php').fadeIn("slow"); }, 10000); </script> <div id="showres"> //data will refresh here </div> You can't view that using Google Chrome though. Firefox works fine with it. I wished myself that I could find something like above that worked with Chrome, but I can't XD Quote Link to comment https://forums.phpfreaks.com/topic/233723-refresh-page-help/#findComment-1202117 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.