I have a Javascript countdown timer in my page. Once the counter reachers zero, I want to redirect the user to another page. However, my page is entering a redirect loop and keeps redirecting to itself.
var count=20;
setInterval(timer, 1000);
function timer()
{
if(count > 0)
{
count = count - 1;
}
else
window.location = "<?= site_url('quiz/complete/' . $session->id); ?>";
document.getElementById("timer").innerHTML = count;
}