当我使用这段代码时,我只设法检索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;
}
最佳答案
你写了这行数据:“recaptcha_response_field =”responseField“& recaptcha_challenge_field =”challengeField,错了.
原文链接:https://www.f2er.com/jquery/427856.html你可以试试这个:
$.ajax({
type: "POST",url: "some.PHP",data: { name: "John",location: "Boston" }
}).done(function( msg ) {
alert( "Data Saved: " + msg );
});
要么
data:{recaptcha_response_field:responseField,recaptcha_challenge_field:challengeField
谢谢,
Chintu