0

谁能告诉我如何为以下验证码编写自定义验证器?我是 jquery 的新手,还没有编写任何自定义验证器。我需要将此自定义验证器与默认验证器一起使用。我试着写,但它没有用。请帮忙

challengeField = $("input#recaptcha_challenge_field").val();
responseField = $("input#recaptcha_response_field").val();
var html = $.ajax({
type: "POST",
url: "recaptcharesponse.jsp",
data: "recaptcha_challenge_field=" + challengeField + "&recaptcha_response_field=" +     responseField,
async: false
}).responseText;
//console.log( html );
$("#prtCnt").html("");
return true;
} else {
$("#prtCnt").html("<font color='#D31145'>Please try again.The characters you entered     didn't match the word verification</font>");   
Recaptcha.reload();                                         
return false;
}

谢谢

4

1 回答 1

0
        challengeField = $("input#recaptcha_challenge_field").val();
        responseField = $("input#recaptcha_response_field").val();

        $.ajax({
        type: "POST",
        async: false,
        url: "recaptcharesponse.jsp",
data: {"recaptcha_challenge_field" :challengeField,"recaptcha_response_field":responseField),
        success:function(msg){
            if(msg == "something from server that captcha is ok"){
              //catcha is ok do wat you want
            }else{
            $("#prtCnt").html("<font color='#D31145'>Please try again.The characters you  entered  didn't match the word verification</font>");   
        Recaptcha.reload();
    }

    },error:function(){


    }

        });
于 2012-06-15T10:19:48.147 回答