Created
January 1, 2012 11:21
-
-
Save robhimself82/1547056 to your computer and use it in GitHub Desktop.
jQuery/AJAX Email Validation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$("#contact_form").validate({ | |
submitHandler: function(form) { | |
$.ajax({ | |
type: "POST", | |
url: "util/misc_func.php", | |
data: { | |
action: "validate_domain", | |
email: $("#form_email").val() | |
}, | |
success: function(output) { | |
// If the domain exists we'll see "true." | |
if (output == "true") { | |
// If any validation errors are showing get rid of them. | |
$("#form_email").parent().find(".error").remove(); | |
// Submit the form. | |
form.submit(); | |
} else { | |
$("#form_email").parent().append(domainError); | |
} | |
} | |
}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment