I have a button that I want to run a function that will make an ajax call and update click_count on my db.
$.ajax({
url: 'my_url'
type: 'post',
data: {id: 1},
success: function(response){
console.log(response.click_count);
}
});
Now, I want to simplify ajax call when user click button quickly. For example, if user click the button 10 times quickly, i will send request with param like:
$.ajax({
url: 'my_url'
type: 'post',
data: {id: 1, click_count:10}, // click_count=10;
success: function(response){
console.log(response.click_count);
}
});
So I just send 1 ajax request for 10 clicks instead of 10 requests.