jquery - Make an ajax call after form checking -
i have form this:
<form id="update_form_password"> <label for="text-input">nouveau mot de passe</label> <input type="password" id="customer_new_password" name="customer_new_password" class="form-control"> <label for="text-input">répétez le mot de passe</label> <input type="paswword" id="customer_repeat_password" name="customer_repeat_password" class="form-control"> <button type="submit" class="btn btn-primary"> enregistrer</button> </form>
i'm using jquery validation plugin check forms correctly filled.
my problem submit form after check.
so have actually:
<script> $('#update_form_password').validate({ rules: { customer_new_password: "required", customer_repeat_password: { equalto: "#customer_new_password" } } }); </script>
but how allow form submitting , continue ajax calls ?
thanks help.
you can use submithandler option make ajax request, prevent default form submit action also.
jquery(function ($) { $('#update_form_password').validate({ rules: { customer_new_password: "required", customer_repeat_password: { equalto: "#customer_new_password" } }, submithandler: function (form) { //something $.ajax({ url: 'url', type: 'post', data: $(form).serialize() }) } }); });
Comments
Post a Comment