2
function pageLoad() {

    clearTimeout("MessagesTimer");
    clearTimeout("NotificationsTimer");

    var MessagesTimer = setTimeout("CheckMessages()", 15000);
    var NotificationsTimer = setTimeout("CheckNotifications()", 15000);
}

After spending a couple of hours trying to understand why this isn't working I'm here to ask you guys why these timers won't clear after partial updatepanel postbacks? If there's a full postback the timers would reset but if i got a partial postback the timers will trigger in less than 15000ms depends on how many partial postbacks it could happen that they trigger with 0ms..

How can I solve this? Thanks

1
  • I'd like the timers to reset on partial postbacks. Commented Nov 8, 2011 at 1:40

1 Answer 1

2
var MessagesTimer;
var NotificationsTimer;

function pageLoad() {
    clearTimeout(MessagesTimer);
    clearTimeout(NotificationsTimer);

    MessagesTimer = setTimeout("CheckMessages()", 15000);
    NotificationsTimer = setTimeout("CheckNotifications()", 15000);
}
  1. Remove the quotes from the clearTimeout lines.
  2. Move definition of timers outside pageLoad function.
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.