jquery - function restart
<p>I have never programmed in jquery. I'm using JQuery Countdown plugin for
to have a countdown when i call a php page but the timer doesn't restart.
I need to write a restart function to call by the 'onExpiry' event of the JQuery Countdown plugin. This is the script that i have on a html page.
I'm following this post :
<a href="http://stackoverflow.com/questions/932540/auto-restart-reset-countdown-timer">Auto Restart/Reset countdown timer</a>
but i think that the solution in that post doesn't work because is about dates.
I need to restart for a random period of maximum 2 hours.
Thanks.....</p>

<pre><code>$(document).ready(function () {
    function randRange() {
        var newTime = Math.floor(Math.random() * 30001) + 10000;
        return newTime;
    }

    function toggleSomething() {
        $('#timeval').load('ajaxTime.php?randval=' + Math.random());
        clearInterval(timer);
        lollo = parseInt(randRange());
        timer = setInterval(toggleSomething, lollo);
        $('#msg').fadeOut("slow").countdown({ *onExpiry:?????* until : +(lollo / 1000),
            format : 'HMS',
            layout : '&lt;div id="timer"&gt;' + '&lt;div class="timer_numbers"&gt;{hnn}:{mnn}:{snn}&lt;/div&gt;' + '&lt;/div&gt;'
        }).fadeIn("slow");
    }
    var timer = setInterval(toggleSomething, 1000);
});
</code></pre>

<p>EDIT:</p>

<p>I solved :</p>

<pre><code>$('#msg').countdown({until: +(lollo/1000), onExpiry: function() { setTimeout(function() { $('#msg').countdown('change', {until: +((lollo/1000) - 1)}); }, 1000); }, format: 'HMS', layout:
    '&lt;div id="timer"&gt;'+
        '&lt;div class="timer_numbers"&gt;{hnn}:{mnn}:{snn}&lt;/div&gt;'+
    '&lt;/div&gt;'
    });
</code></pre>

<p>If anyone has a better solution please contact me    pro-zac31[at]libero.it .... !!! Thanks :)</p>
