$.validator.addMethod( "conflictaccount" , function(value,element){ console.log("account:" + value); var isValidate = true; $.checkUserAccount( { async:false,//avoid value of return is false endpoint : HOSTNAME, ticket : TICKET, uid: value, callback:function(data){ if(data.verify){ //confilct account // console.log("confilct"); isValidate = false; }else{ // console.log("Not Conflict"); isValidate = true; } } }); // console.log("isValidate:" + isValidate); return isValidate; });
註:$.checkUserAccount裡面是call $ajax的方法。
沒有留言:
張貼留言
留個話吧:)