I have a link with some parameter which loads another page like:
<a href="/cart.php?action=save&" class="prevent_doubleclick">save</a>
When someone clicks on the link, it will change the text from save
to please wait...
.
Meanwhile the browser is loading the /cart.php
page but I'm still on the current page which takes around 3 to 5 seconds and the user is able to click 10 more times on the link which will result in sending the parameters many times and each time a new item is saved.
I can't disable the click
event
with .one()
or return false
or unbind
since the user triggers
the click
the first time by actually clicking on the link and I trigger
a second click
event
after 2 seconds by code. So if I disable the click event after the user has clicked the link then my $('.element').trigger('click');
won't work anymore.
Any ideas on how this is doable?