-1
an
Ich versuche derzeit, das Formular vom Einreichen abzuhalten, wenn das recaptcha false zurückgibt, was es tut, aber es übergibt noch das Formular. Ich habe e.preventDefault auch verwendet und das funktioniert nicht, also muss etwas nicht ganz richtig sein.recaptcha 2 gibt false zurück, gibt aber immer noch fom
Vielen Dank im Voraus für Ihre Hilfe.
JQUERY:
submit: function() {
$form = $('#registration-form');
$form.submit(function (e) {
$output = _validate($form);
if($output == false) {
e.preventDefault(e);
} else {
$.ajax({
type: "POST",
url: "http://" + window.location.hostname + "/wp-content/themes/Listex/includes/plugins/forms/recaptcha.php",
async: false,
data: "g-recaptcha-response=" + grecaptcha.getResponse(),
success: function(response) {
alert(response);
if (response == "false")
return false;
}
});
}
});
},
recaptcha.php:
<?php
$secret="secret code";
$response = $_POST["g-recaptcha-response"];
$verify=file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret={$secret}&response={$response}");
$captcha_success = json_decode($verify);
echo json_encode($captcha_success->success);
Sie können nicht alles von einer asynchronen Callback-Funktion – geocodezip
leid, das ist etwas, kehre ich auf Stackoverflow sah und versuchte, noch nicht ohne funktioniert – Max