Created
September 22, 2015 16:29
-
-
Save nola/c75140a84696c95f1031 to your computer and use it in GitHub Desktop.
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
$('form').validate({ // initialize the plugin | |
rules: { | |
email: { | |
required: true, | |
email: true | |
} | |
}, | |
submitHandler: function (form) { | |
//alert('valid form submitted'); // for demo | |
$.ajax({ | |
type: "POST", | |
url: "util.php", | |
data: $(form).serialize(), | |
success: function() { | |
$('.form-message').html("<div id='message'></div>"); | |
$('#message').html("<h2>Thanks for signing up!</h2>").append("<p>Your information has been submitted. A welcome email is on its way and should arrive shortly.</p>").hide().fadeIn(750, function() { | |
$('#message'); | |
}); | |
} | |
}); | |
return false; // for demo | |
} | |
}); |
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
<script src="http://jqueryvalidation.org/files/dist/jquery.validate.min.js"></script> | |
<script src="http://jqueryvalidation.org/files/dist/additional-methods.min.js"></script> | |
<form action="util.php" method="post"> | |
<br> | |
<label for="email" >email</label> | |
<input type="text" name="email" id="email"> | |
<br> | |
<input id="submit" type="submit" name="submit"> | |
</form> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment