I would like to make sure there is only one AJAX request going on (for a user) at a time. This is what I tried:
var ajaxFinished = 1;
$('#selector').keyup(function() {
if (ajaxFinished == 1) {
ajaxFinished = 0;
$.get('test.php', { par : "par" }, function(data) {
// do stuff with data
ajaxFinished = 1;
});
}
});
But the problem is the AJAX request gets executed only once now even though I activate the event multiple times.