title: countdown function keeps on looping after 12 seconds - please assist
body: <p>I have a PHP page that consists of many data and functions of it, so whenever I click to go to this specific page it loads around 12 seconds. So to notify the user, I have included the below code but it refreshes again and again by decreasing &lt;=0 but the data is already there after 12 seconds completed. Please assist on which line of code I need to change below. Thank you.</p>
  <pre><code>&lt;p align=&quot;center&quot;&gt;You will be redirected in &lt;span id='counter'&gt;12&lt;/span&gt; second(s).&lt;/p&gt;
  
  &lt;script type='text/javascript'&gt;
  
      function countdown() {
      var i = document.getElementById('counter');
      if (parseInt(i.innerHTML)&lt;=0) {
      location.href = 'studentPredict.php';
      }
      i.innerHTML = parseInt(i.innerHTML)-1;
      }
      setInterval(function(){ countdown(); },1000);
      
  &lt;/script&gt;'&quot;;
  </code></pre>