Ajax requests not completing before page redirect
<p>I have an admittedly large amount of ajax requests being sent out with an onclick trigger.</p>

<p>(Probably close to 30 requests).</p>

<p>It looks something like this:</p>

<pre><code>if($(this).attr('id') == 'checkbox'){
    var type = 'checkbox';

    // loop over checkbox inputs and store in array 'checkboxarray'
    var checkboxarray = [];
    $(this).find('input').each(function(){
        checkboxarray.push($(this).next('span').text());
    });
}
else if($(this).attr('id') == 'dates'){
    var type = 'dates';
    var default_value = $(this).find('input').val();
}
else{
    alert('Error: There has been an unknown extra iteration');
}

// Send as ajax call to be processed
$.ajax({
    type: "POST",
    url: "process.php",
    data:  "type="+type+"&amp;default_value="+default_value+"&amp;checkboxarray="+checkboxarray+,
    success: function(html){

    }
});


$("#processessing").show();
$('#outer_container').html('&lt;br /&gt;&lt;br /&gt;Processing…&lt;br /&gt;&lt;br /&gt;'); 

// once all of the requests stop, fire it off.      
$("#processessing").ajaxStop(function(){
    $(this).hide();
    $('#outer_container').html('Saved'); 
    function redirect(){
        window.location = "page.php";
    }
    setInterval(redirect,500);
});
</code></pre>

<p>On small amounts of data this works, but on large sets of data, a lot gets lost... any suggestions?</p>
