Updating the timer value without refreshing the page

时间:2019-01-09 22:18:48

标签: javascript jquery

I'm having difficulties resolving this problem. The thing is, I have 2 timers on the page, countdown timer #1 (10 mins) and cd timer #2 (25 mins). As soon as the either timer hits "1", I want to e redirected to the another page. It works fine when i refresh page manually, but the problem occurs when I'm already on the page that holds the timers (since the script is loaded before it hits "1"). How do I make it work dynamically? Whenever I'm on page, without refreshing it, I want to be redirected when the timers hit "1". Here's what I've got:

var a = $('table.thinline:eq(1)>tbody>tr:eq(2)>td:last').text(); // timer #1
var b = $('table.thinline:eq(1)>tbody>tr:eq(1)>td:last').text(); // timer #2

  if ($('#someId:contains(a)').length && a == "1"){
  window.location.href = "some link";
}

Thanks in advance.

0 个答案:

没有答案
相关问题