I have this upload then you can crop your image, but if you press twice quickly then it uploads 2 and it all gets crazy. How can i block the button RIGHT after it starts sending request, and where should i place it?
(in jquery ajax)
I have this upload then you can crop your image, but if you press twice quickly then it uploads 2 and it all gets crazy. How can i block the button RIGHT after it starts sending request, and where should i place it?
(in jquery ajax)
You could try this:
<button id="foo">Click</button>
<script type="text/javascript">
$(function() {
$('#foo').click(function() {
$(this).attr('disabled', true);
});
});
</script>
The important part of course is $(this).attr('disabled', true); You can then enable the button again by setting the attribute to false.