Based on: Abort Ajax requests using jQuery... In inventory_search() - before the ajax request is made, how can I check for any current requests and abort() them before makin
Spinon's answer is great for aborting all ajax queries but not great for keeping track of just one.
I often find myself doing something like
var ajax_request;
function do_something()
{
if(typeof ajax_request !== 'undefined')
ajax_request.abort();
ajax_request = $.ajax({
type: 'post',
url: '/test.php',
data: search_data,
success: function(data) {
$('#catalog').html(data);
}
});
}