jquery.ajax multiple data problem
Posted
by Guillaume P
on Stack Overflow
See other posts from Stack Overflow
or by Guillaume P
Published on 2010-03-23T17:09:49Z
Indexed on
2010/03/23
17:13 UTC
Read the original article
Hit count: 378
Hi, I've been trying to make this code work for the last 3 hours. I've tried about everytinh, but I'm still unable to get it to work.
I only managed to send 1 data.
When I use this code, I only manage to retrieve recaptcha_challenge_field. If I remove recaptcha_challenge_field, I retrieve recaptcha_response_field. However, I am unable to retrieve the two at the same time.
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;
}
© Stack Overflow or respective owner