javascript - jquery validations not woking when ajax call is there -


i have js code validating form using jquery validations. , after calling ajax.

$('.form').validate({     rules: {         ----      } }); $('#submit').click(function() {      $.ajax(url,{         data:data,         success:onsuccess,         error:onerror,         type:post     });     return false; }); 

onsuccess , onerror simple functions. url predefined

but code not entering validations , directly calling ajax whatever might case.

you should not bind click event on submit button. should place function on submithandler option of jquery validation. this

 $('.form').validate({     rules: {     ----      },     submithandler: function(form){         //your code here..     } }); 

here's jquery validation docs better understand.


Comments

Popular posts from this blog

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -