jQuery abort all AJAX requests(query) on click of a button
<p>How can I cancel/abort/stop all AJAX requests/query that I have not yet received the response with button or some click event? Because I make multiple AJAX calls. Here is my code:</p>

<pre><code>function makeCalls() {
    var urls = ["url1.php", "url2.php", "url3.php", "url4.php"];
    $.each(urls, function(index, value) {
        $.ajax({
            global: false,
            type: 'POST',
            url: value,
            dataType: 'html',
            data: returnData(),
            cache: false,
            timeout: 60000,
            success: function(result) {         
                switch(value) {
                    case "url1.php":
                        // my code for url1 
                    case "url2.php":
                        // my code for url2 
                    case "url3.php":
                        // my code for url3 
                    case "url4.php":
                        // my code for url4 
                }
            },
            error: function (request, status, error) {
                console.log('ERROR: ' + request.responseText);
            }
        });
    });
}
</code></pre>