server got stuck
Moderator: General Moderators
Re: server got stuck
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?
- iankent
- Forum Contributor
- Posts: 333
- Joined: Mon Nov 16, 2009 4:23 pm
- Location: Wales, United Kingdom
Re: server got stuck
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.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?
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
Re: server got stuck
Thanks dude...
I will try it and back to you again..
Thanks for your efforts
..
I will try it and back to you again..
Thanks for your efforts