I am working on disabeling Buttons after the user clicked them, to prevent double submissions or actions. I have 2 types of buttons. A php button(or form button) that does a submit and reloads the page. I got no prblem with that. Cause i just disable the button for ever, and after the reload is pushable again. Here an example:
$(document).on('click', 'button', function() {
var $this = $(this);
htmls = $(this).html();
$(this).prop("disabled", true);
setTimeout(function(){
$this.prop("disabled", false);
}, 2000);
});
this is now for 2 seconds but i will remove the setTimeout part. The bigger problems are the Javascript buttons, this buttons wont reload the page. When the user pushes the button it should be disabled until the process ends that was started with the button, and the enable it again. I can check if the button does a submit, or it just lets say clears all fields in the form. I was thinking maybe i can get the process that was started with the button push and then when it ends i can work on. Is this even possible? Or is there some other workaround?