当我使用这段代码时,我只设法检索recaptcha_response_field.如果我删除recaptcha_response_field,我会检索recaptcha_challenge_field.但是,我无法同时检索这两个.我只设法发送1个数据.
challengeField = $("#recaptcha_challenge_field").val();
responseField = $("#recaptcha_response_field").val();
var html = $.ajax(
{
global: false,
type: "POST",
async: false,
dataType: "html",
data: "recaptcha_response_field=" + responseField + "&recaptcha_challenge_field=" + challengeField,
url: "../ajax.recaptcha.php"
}).responseText;
if(html == "success")
{
$("#captchaStatus").html("Success. Submitting form.");
return true;
}
else
{
$("#captchaStatus").html("Your captcha is incorrect. Please try again");
Recaptcha.reload();
return false;
}
Run Code Online (Sandbox Code Playgroud)