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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.