Jump to content

Ajax Automatic refresh


besly98

Recommended Posts

i have this code, it works fine for normal refreshing...

<script type="text/javascript">
var auto_refresh = setInterval(
function ()
{
$('#match_main').load('match_engin.php1?counter=<?echo $_GET['counter'];?>');
},  10000); // refresh every 10000 milliseconds

</script>

 

 

but i want to add a counter, so each 10 seconds, when it reloads the DIV, it increments a counter by 1. is this possible? i have been trying for ages i cant fix it...

Link to comment
https://forums.phpfreaks.com/topic/235587-ajax-automatic-refresh/
Share on other sites

<script type="text/javascript">

var count = <?echo $_GET['counter'];?>;

var auto_refresh = setInterval(

function ()

{

$('#match_main').load('match_engin.php1?counter=' + counter, function () {

 

counter++;

});

},  10000); // refresh every 10000 milliseconds

 

</script>

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.