相关疑难解决方法(0)

Google reCaptcha回复"Uncaught(in promise)null"

我使用reCaptcha v2但在Uncaught (in promise) null任何情况下都在开发控制台响应(并移动.reset()函数)

安慰:

在此输入图像描述

我的recaptcha代码:

<div class="text-xs-center" style="text-align: center; height:150px;">
    <p style="color: black;"> Complete the verification: </p>
    <div style="display: inline-block;" class="g-recaptcha" data-sitekey="xxxxxxxxxxx" data-callback="callback"></div>
</div>
Run Code Online (Sandbox Code Playgroud)

我的回调函数:

function callback() {
    if (grecaptcha === undefined) {
        alert('Recaptcha non definito'); 
        return; 
    }

    var response = grecaptcha.getResponse();
    console.log(response);

    if (!response) {
        alert('Coud not get recaptcha response'); 
        return; 
    }

    $.ajax({
    'url' : 'validate-recaptcha.php',
    'type' : 'POST',
    'data' : {
        'response' : response   
    },
    'success' : function(data) {              
        alert('Data: '+data);
    }, …
Run Code Online (Sandbox Code Playgroud)

html javascript php ajax recaptcha

33
推荐指数
5
解决办法
2万
查看次数

标签 统计

ajax ×1

html ×1

javascript ×1

php ×1

recaptcha ×1