I have created a simple text-based game using HTML where the player wants to sell their item.
<input name="gg1" id="gg1" value="10">
<a href="javascript:;" onclick="fastbtn(1);">Sale</a>
<script>
function fastbtn(sid){
var aa = jQuery("#gg"+sid).val();
if(aa > 0){
aa--;
jQuery("#gg"+sid).attr("value", aa);
ajaxget('plugin.php?id=game&do=store&submit=true×tamp=12345&gg1[1]=1&ggqty[1]=1&formhash={FORMHASH}&fastbuy=true','bbb'); //this is my ajax function -> ajaxget(requesturl,return result to id);
}
</script>
For example, the value = 10
, but when the user clicks 10
times quickly (fast clicking), the value
turns to 0
, but my server-side only processes 8
times.
Is there any way to match the quantity of clicks with the server side?
In my thinking, is it possible for the second click of fastbtn(sid)
to wait until the first click of fastbtn(sid)
's ajaxget
is completed before processing?