Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Remote validation with jQuery validate plugin

View form.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14
$("#form-leads").validate({
rules: {
email: {
required: true,
email: true,
remote: "verifica_email.php"
}
},
messages: {
email: {
remote: "Este email já está cadastrado."
}
}
});
View form.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
<?php
require_once "config.php";
$email = mysql_real_escape_string($_GET["email"]);
$sql = "SELECT * FROM leads WHERE email = '$email'";
$query = mysql_query($sql);
if(mysql_num_rows($query) > 0) {
echo "false";
} else {
echo "true";
}
mysql_close($conn);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.