commandos
Dec 30th 2008, 10:27 pm
i have a number let say ... number of visitors for a page (it's not that but similar in some way)
i'm using jquery to show how many visitors the site got , and i have a div that contain the number let say
<div id="counter"> </div>
and in the jquery i have the followings :
<script>
// the call for the update (it just change an entry in the db total = total + 1;
function autoupdate() {
$.post("count.php", {count:1},
function(data){
$("#counter").html(data);
});}
// the 1 sec interval
$(document).ready(function() {
setInterval("autoupdate()", 1000);
});
</script>
question : would that be too harsh on a server if it receive a lot of visitors ?
my aim is to show a live counter , with live update like gmail (like how many mb they are hosting .. i know their example is fake ...but wanted to do something similar)
i'm using jquery to show how many visitors the site got , and i have a div that contain the number let say
<div id="counter"> </div>
and in the jquery i have the followings :
<script>
// the call for the update (it just change an entry in the db total = total + 1;
function autoupdate() {
$.post("count.php", {count:1},
function(data){
$("#counter").html(data);
});}
// the 1 sec interval
$(document).ready(function() {
setInterval("autoupdate()", 1000);
});
</script>
question : would that be too harsh on a server if it receive a lot of visitors ?
my aim is to show a live counter , with live update like gmail (like how many mb they are hosting .. i know their example is fake ...but wanted to do something similar)