javascript - Jquery validation does not submit form in once click when ajax call is async -


this question has answer here:

i using jquery validation customized function check duplicate values in database ajax call , ajax call async. issue when fills value , click on submit button directly "without focus out field" form not getting submit though validation function returning true. need click on submit again submit form. below code using: add customized rule:

jquery.validator.addclassrules("checkduplicate", {checkduplicate: true}); 

the function "checkduplicate" :

$.validator.addmethod("checkduplicate", function (value, element) {     var returnvalue = false;     $.ajax({         type: "post",         async: false,         url: '/check-duplicate',         data: {value: $('#value').val()},         success: function (response)         {             if (response.status == true) {                 returnvalue = false;             } else {                 returnvalue = true;             }         }     });     return returnvalue; }, 'duplicate value'); 


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -