how to loop using jquery
<p>I have been working on a count down for most of today, and now I am stuck on looping. Without the for loop everything works fine the count down hits 0 and reloads, but with the for loop it doesn't count down properly and skips numbers. What I would like to accomplished here is to have the timer count down completely and after 3 complete count downs it will stop completely. What am I doing wrong here?</p>

<pre><code>var number = 25;
var i;

function countdown() {
    $('#display').html("Redirecting in " + number + " second(s).");
    for (i = 0; i &lt; 3; ++i) {
        number--;
        if (number &lt; 0) {
            window.location.reload();
            number = 0;
        }
    }
    setTimeout(countdown, 1000);
}

$(document).ready(function() {
    countdown();
});
</code></pre>
