I have this jQuery event:
$('#button-next').bind('click', function() {
$.ajax({
type: "GET",
dataType: "json",
url: 'index.php?route=product/category/display&cat=any&limit='+p+',1',
cache: false,
success: function(data) {
var text = data.output;
goForward('scroller', text);
p++;
}
});
});
That inserts a new item to the list and removes the last one. The problem is if the user starts clicking on the button so fast, it gets messed up. I need a way to prevent new calls before that last one is finished.
You could use the
.one()method to subscribe to the click action:where you could define the
processfunction like this: