Page 2 of 2

Re: server got stuck

Posted: Sat Nov 21, 2009 6:38 am
by dell6400
Yes it is in dedicated server. but I do not understand it how we can do this e.g., update countdown every 1 second but only ask server for updates every 5 seconds). how we can do it? could you tell me?

Re: server got stuck

Posted: Sat Nov 21, 2009 6:41 am
by iankent
dell6400 wrote:Yes it is in dedicated server. but I do not understand it how we can do this e.g., update countdown every 1 second but only ask server for updates every 5 seconds). how we can do it? could you tell me?
You need to setup multiple timers in your javascript code, i.e. one timer that does nothing but update the countdown timer display, and a second timer that does nothing but ask the server if there have been any updates. E.g.

Code: Select all

 
var updateTimer = 0;
var countdownTimer = 0;
function checkForUpdates() {
    // your ajax code to retrieve updates from server here
}
function updateCountdowns() {
    // your code to update countdown timers here
}
 
updateTimer = setInterval('checkForUpdates()', 5000); // check for udpates every 5 seconds
countdownTimer = setInterval('updateCountdowns()', 1000); // update the countdowns every 1 second
 
hth

Re: server got stuck

Posted: Sat Nov 21, 2009 6:56 am
by dell6400
Thanks dude...

I will try it and back to you again..

Thanks for your efforts :cry: :cry: ..