title: javascript timer counting very fast as time passes
body: <p>I want a counter which reset in specific interval of time. I wrote this code. When I refresh the page it is executing perfectly. But as time passes the timer goes really fast, skipping seconds. Any idea why this is happening.</p>
  
  <pre><code>function countdown_new() {
  
      window.setInterval(function () {
          var timeCounter = $("b[id=show-time]").html();
          var updateTime = eval(timeCounter) - eval(1);
          $("b[id=show-time]").html(updateTime);
  
          if (updateTime == 0) {
              //window.location = ("ajax_chart.php");
              $("b[id=show-time]").html(5);
              clearInterval(countdown_new());
              // countdown_new();
              //my_ajax();
          }
      }, 1000);
  
  }
  
  
  window.setInterval(function () {
      countdown_new();
  }, 5000)
  </code></pre>
  
  <p>HTML 
      
          Coundown in 5 seconds
      </p>