Disable submit buttons while performing validation

This commit is contained in:
Naoki Takezoe
2014-07-13 03:47:40 +09:00
parent a2a2e22485
commit 2e11d6dd78

View File

@@ -12,12 +12,14 @@ $(function(){
function validate(e){
var form = $(e.target);
$(form).find('[type=submit]').attr('disabled', 'disabled')
if(form.data('validated') == true){
return true;
}
$.post(form.attr('action') + '/validate', $(e.target).serialize(), function(data){
$(form).find('[type=submit]').removeAttr('disabled')
// clear all error messages
$('.error').text('');