0
的jQuery:的Recaptcha AJAX不wotking
alert(grecaptcha.getResponse());
var captchadata = {
captchavalue: grecaptcha.getResponse()
}
$.ajax({
type:"POST",
url:"<?php echo base_url()?>index.php/User/captcha",
data: captchadata,
success: function(response){
if(response == 1){
alert('success');
}
}
})
}
PHP:
$value = $this->input->post('captchavalue');
echo $value;
if(isset($value)){
$captcha = $this->input->post('captchadata');
echo 'if executed';
}
$response=json_decode(file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=6LcA1hwUAAAAADGmQKlRcCeugOUkbk-8NSGVhff0&response=".$captcha."&remoteip=".$_SERVER['REMOTE_ADDR']), true);
if($response['success'] == true){
echo 1;
}
else{
echo 0;
}
正面它提醒captcha
值。即使不顯示$value
,我的PHP文件也沒有響應。我該如何解決這個錯誤以及它爲什麼發生?請幫幫我。