ajax - Jquery validation async not working -
ajax - Jquery validation async not working -
i have made function, seems work fine, homecoming "#" insted of wainting ajax. have tried remove homecoming call, out look.
it need wait until ajax finish before return. jsp working fine.
what wrong?
jquery.validator.addmethod("knidexist", function(value, element) { var valid = "#"; $.ajax({ async: false, type: "post", url: "user.jsp", data: "knid="+value, datatype: "html", success: function(msg) { // if user exists, returns string "true" if($.trim(msg) != "true") { //return false; valid = false; // exists } else { //return true; valid = true; // username free utilize } } }); homecoming valid; }, 'this user not exist');
instead of adding own validation method, need utilize built-in remote
validation method instead designed purpose.
you utilize in manner like
remote: { type: "post", url: "user.jsp", data: { knid: value }, }
check out examples docs link to.
jquery ajax validation
Comments
Post a Comment