日期:2014-05-16  浏览次数:20364 次

jquery验证得不到正确的结果,大家帮我分析一下哈,谢谢
//注册表单验证
$(function(){

$.validator.addMethod("af",function(value,element,params){
var a=123;
$.post("/seller/checkmember?act=login&op=check_member&column=ok",{user_name:value},
   function(data){
        if (data.message==''){
        $("#member_truename").val(data.member_truename);
        $("#member_id").val(data.member_id);
        a='true';
        
        $("#ismember").val('true');
                
                          }else{                                $("#member_name").val('');
                               a='false';
                               $("#ismember").val('false');
                          }
   },"json");
return a;
               
},"");


jQuery.validator.addMethod("lettersonly", function(value, element) {
return this.optional(element) || /^[^:%,'\*\"\s\<\>\&]+$/i.test(value);
}, "Letters only please"); 
jQuery.validator.addMethod("lettersmin", function(value, element) {
return this.optional(element) || ($.trim(value.replace(/[^\u0000-\u00ff]/g,"aa")).length>=3);
}, "Letters min please"); 
jQuery.validator.addMethod("lettersmax", function(value, element) {
return this.optional(element) || ($.trim(value.replace(/[^\u0000-\u00ff]/g,"aa")).length<=15);
}, "Letters max please"); 
    $('#recharge_form').validate({
        errorPlacement: function(error, element){
            var error_td =element.parent('dd');         
            error_td.find('.field_notice').hide();
            error_td.append(error);
        },
        success       : function(label){
            label.addClass('validate_right').text('OK!');
        },
        onkeyup: false,
        rules : {
  &