chandra7799 commited on
Commit
33d8a68
·
verified ·
1 Parent(s): 9424dae

Update templates/index.html

Browse files
Files changed (1) hide show
  1. templates/index.html +11 -9
templates/index.html CHANGED
@@ -57,16 +57,18 @@
57
 
58
  function updateTimerOutput() {
59
  var timerOutput = document.getElementById("timer_output");
60
- var remaining = parseInt(document.getElementById("seconds").value);
61
  var interval = setInterval(function() {
62
- if (remaining > 0) {
63
- timerOutput.innerText = remaining + " seconds remaining...";
64
- remaining--;
65
- } else {
66
- timerOutput.innerText = "Time's up!";
67
- clearInterval(interval);
68
- }
69
- }, 1000);
 
 
 
70
  }
71
  </script>
72
 
 
57
 
58
  function updateTimerOutput() {
59
  var timerOutput = document.getElementById("timer_output");
 
60
  var interval = setInterval(function() {
61
+ fetch("/get_timer")
62
+ .then(response => response.json())
63
+ .then(data => {
64
+ if (data.message) {
65
+ timerOutput.innerText = data.message;
66
+ }
67
+ if (data.message === "Time's up!") {
68
+ clearInterval(interval);
69
+ }
70
+ });
71
+ }, 1000); // Poll every second to get the timer update
72
  }
73
  </script>
74