I have button. Click this button send $.post() request and add item to basket. I want that if user clicks button fast ten times, it mustn't send 10 requests, but only one width count 10.
code like this:
<div class='qty'>
<input type='text' id="qty" value='1'>
<a class='button' href='#'>add To Basket</a>
</div>
script:
$(document).ready(function(){
$(".button").click(function(){
var qty=$(this).parent().find(input[type='text']).val();
$.post('/ajax.php', "qty="+qty, function(){
$(this).parent().find(input[type='text']).val("1");
});
});
});
qtyinput, you can't use the sameidfor each of them.