任何人都可以告诉我如何为下面的验证码编写自定义验证器吗?我是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;
}
由于
答案 0 :(得分: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(){
}
});