Ajax not working with jquery validate plugin

前端 未结 1 452
轻奢々
轻奢々 2021-01-27 14:59

My ajax success/failure event is not firing. I am using jquery validation and inside that i am using ajax for form submit. My forms are getting submitted but return value(JSON

相关标签:
1条回答
  • 2021-01-27 15:17

    As pointed out by Barmer in his first comment, there are several issues with this code...

     submitHandler: function(form) {
         e.preventDefault;
         ....
    
    1. Variable e does not exist within this submitHandler function.

    2. You've failed to include the parenthesis in .preventDefault().

    3. You don't need .preventDefault() in this context since the plugin is already blocking the default submit. Remove this line entirely.

    NOTES:

    For good readability, don't mix Allman with 1TBS style code formatting... just be consistent throughout. Additionally, it might be best to avoid using Allman in JavaScript altogether.

    0 讨论(0)
提交回复
热议问题