I can't get jquery.validate to submit without refresh via ajasSubmit
Hello,
I might as well say it, Im just not as good as I think with jQuery. I can get the validation exactly as I like using
- <script type="text/javascript">
$.validator.methods.equal = function(value, element, param) {
return value == param;
};
$(document).ready(function() {
var validator = $("#request").bind("invalid-form.validate", function() {
$("#summary").html("Your form contains " + validator.numberOfInvalids() + " errors, see details below.");
}).validate({
//debug: true,
errorElement: "em",
errorContainer: $("#warning, #summary"),
errorPlacement: function(error, element) {
error.appendTo( element.parent("li"));
},
success: function(label) {
label.text("ok!").addClass("success");
},
rules: {
hs_customer_firstname: {
required: true,
minlength: 2
},
hs_customer_lastname: {
required: true,
minlength: 2
},
hs_customer_email: {
required: true,
email: true
},
hs_category: {
required:true
},
hs_customLargeTextField: {
required: true
},
math: {
required: true,
equal: <?php echo $randomNumTotal; ?>
}
},
messages: {
hs_customer_firstname: {
required: "Please Enter Your First Name",
minlength: "Your First Name Must be at Least 2 Characters"
},
hs_customer_lastname: {
required: "Please Enter Your Last Name",
minlength: "Your Last Name Must be at Leaset 2 Characters"
},
hs_customer_email: "Please enter a valid email address",
hs_Category: {
required: "Please Select a Category"
},
hs_customLargeTextField: "Please Leave a Comment",
math: {
required: "Please Solve the Problem",
equal: "Please Solve the Problem"
}
});
- });
</script>
But I simply cannot get it to submit with Ajax (no refresh) without this it works fine, submits the form and all. Can anyone please help? Im dying here!