I\'m working on this project and am getting stuck with form validation. I have two forms, Form X and Form Y and I wanna use the jQuery validation plugin to implement client-
Your ajax
belongs inside the submitHandler
callback of the Validate plugin. You also need to wrap everything inside a DOM ready hander function to ensure the HTML exists when .validate()
is called. You should not need any ajax
outside of .validate()
, nor should you need any additional click
handlers.
Documentation: http://jqueryvalidation.org/validate/
submitHandler (default: native form submit)
Type: Function()
Callback for handling the actual submit when the form is valid. Gets the form as the only argument. Replaces the default submit. The right place to submit a form via Ajax after it validated.