Jump to content

refresh page help


matthew9090

Recommended Posts

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!

Link to comment
https://forums.phpfreaks.com/topic/233723-refresh-page-help/
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/233723-refresh-page-help/#findComment-1202117
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.