It is jQuery.
I have a signup form. At the domain textbox field, people fill in domain, then onblur Ajax call to registar API for validation on domain availability.
The validation may take up to 15 seconds depending on network speed.
In this waiting period, if user go to click submit button, how to block?
My idea is simple: Before any Ajax call finish loading, I don't want to allow people to click submit.
I can think of a way, but I am not sure whether this is a good way. I need advice.
beforeSend: function(){
$("#btnSubmit").attr("disabled", "disabled");
},
complete: function(){
$("#btnSubmit").attr("disabled", "");
}
<input type="button" name="btnSubmit" id="btnSubmit" value="my button" />