サーバーにデータを送信するために POST リクエストを使用していますが、次のような従来のリクエストを送信する方がよい場合は、次のようにします。
$.post(
"<?php echo Settings\Path\URL::$ajax?>/ajaxValidator.php",
{
item : "Captcha",
recaptchaChallenge : Recaptcha.get_challenge(),
recaptchaResponse : Recaptcha.get_response()
},
function(result){
if(result == "true"){
signup();
} else {
$("#signupRecaptchaError").show();
recaptchaCreate();
}
}
);
または、次のように JSON を使用して POST リクエストを使用してデータを送信する方がよい場合:
var data = {
item : "Captcha",
recaptchaChallenge : Recaptcha.get_challenge(),
recaptchaResponse : Recaptcha.get_response()
}
$.post(
"<?php echo Settings\Path\URL::$ajax?>/ajaxValidator.php",
data,
function(result){
if(result == "true"){
signup();
} else {
$("#signupRecaptchaError").show();
recaptchaCreate();
}
}
);
何か違いがあるとすれば、それが何であるかを教えていただけますか?