get a return value from setInterval function
<p>i have an ajax function which gets called and returns json data. this function is called via a setInterval loop:</p>

<pre><code>    function SetMaxBidReload() {
        var reloadInt = 6000;
        var doReload = true;

        //set some logic here

        if (doReload) {
            setInterval(function () { ReloadMaxBid(); }, reloadInt);
        }
    }

    function ReloadMaxBid() {
        var nextReload;
        $.ajax({
            url: 'ajaxcall.aspx',
            cache: false,
            success: function (data) {
                //change to dom elemants here based on return data
                nextReload = data[0].NextReload;
            }
        });
        return nextReload;

    }
</code></pre>

<p>what im trying to do is change the reloadInt of setInterval based on what comes back from the ajax call.</p>

<p>a: is that possible and b: how do i do it?</p>

<p>im open to suggestions on how to accomplish this by coding it differently</p>
