0

I am trying lot to get it work but no luck..any jquery expert can share there view please.

i have form, for validation i use form validation plugin (jquery) which doese validation correctly when i put.

$("#contact").validationEngine();  // #contact is my form id.

now i want to submit the form using ajax on button click (submit form button) which is also happening correctly using following.

$(".button").click(function() {
 ajax code goes here ...
}

here problem is when i click on submit button it goes and update database it does not wait for formvalidation plugin to validate it...

what actually i want to do is first validate the form if all okay then go and call ajax function to update the database. if validation fails then dont call ajax function to update data base.

could any one please share some clues.

Thank you in advance...

regards, Mona.

4

1 回答 1

0
 $(function() {
   $("#contact").validate({
     rules: {

     },
    submitHandler: function(form){
  ajax call
    }
 });
});

原始帖子jQuery:在提交之前验证 是否有助于解决您的问题。

于 2012-11-30T21:06:58.963 回答