How to externally pause and stop recursive javascript function
<p>I have a function which calls itself with a pause of 2 seconds until the ajax call returns 0. Now it can go on for a long time, hence i wish to pause it or stop it with an external event like a button click.</p>

<pre><code>function create_abcd()
{
    var dataString = 'action=create_abcd&amp;type=' + $('#abcd_type').val() + '&amp;count=100';
    $.ajax({
        type: "POST",
        url: "backend.php",
        data: dataString,
        success: function(msg){
            if(msg != "0")
            {
                $("#abcd_output").append('&lt;p&gt;' + msg + '&lt;/p&gt;')
                    setTimeout(create_abcd, 2000);
            }
            else
                return false;
        }
    });
}
</code></pre>

<p>any help would be greatly appreciated!</p>
