javascript - How to use AJAX with jQuery validation? -


i want validate login (checking server see whether login free or not - returns json) jquery validation plug. read using remote function in jquery, failed implement properly. want without php, , use link server, can see in code below.

i managed create code works, had make getjson synchronous. here code:

jquery.validator.addmethod("isitfree", function(value, element) {   $.ajaxsetup({async: false});   var isitfree = null;   $.getjson('http://.../register/check/'+value, function(data) {     $.parsejson(data);     isitfree = !data[value]; // server response false if login isn't taken   });   $.ajaxsetup({async: true});   return this.optional(element) || isitfree; }); 
  • is there way without making getjson synchronous , jquery validation plugin?


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -