/ Published in: jQuery
Valiodate a form with jQuery.Validate and submit it with jQuery.form
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
$(document).ready(function(){ var f = $("#signup_form").validate({ rules: { firstname: "required", lastname: "required", email: { required: true, email: true }, comment: { maxlength: 200 } }, submitHandler: function(form) { $("#signup").ajaxSubmit({ success: showResponse }); return false; } }); function showResponse(responseText, statusText, xhr, $form) { f.resetForm(); $('.msg').html('Thank you, your message was successfully sent'); } });