P.S.: Read \"EDITED on 2019-06-29\":
I have a webform for updating user information, and when he updates his email a verification is performed via
You should not use .submit()
on this situation, use a flag system instead, .submit()
should only be used for elements.
var email = jQuery('#email').val();
var flag = 0;
jQuery.ajax({
type : 'GET',
url : '/ajax/verify-email.php?email=' + email,
async: false,
success : function( d ) {
if( d == '1' ) {
alert('Another user is using this email');
jQuery('input[name="email"]').focus();
flag = 1;
}
}
});
if(flag == 1) return false;