I have a button or anchor element that redirect the user to a different view. Once the button is clicked, it fires a DB write event. However, when the user clicks the button multiple times waiting for the page to reload, multiple records get created and it causes issues with the application saving the form that follows.
What is the best way, maybe in javascript or jQuery to ignore the clicks after the first one?
UPDATE:
I actually did this and it worked -- it doesn't disable button but returns false on the on click event.
<script>
$("#linkresponse").click(function() {
$(this).click(function() {
return false;
});
return true;
});
</script>
Does this seem like a good solution, any reason I shouldn't follow it?