小编jei*_*da 的帖子

Google reCAPTCHA V2 JavaScript我们检测到您的网站未在验证reCAPTCHA解决方案

错误消息 我们检测到您的站点未在验证reCAPTCHA解决方案。这是在您的站点上正确使用reCAPTCHA所必需的。请访问我们的开发者网站以获取更多信息。 我创建了这个reCaptcha代码,效果很好,但是我不知道如何验证它,我以为它正在使用该函数进行验证, grecaptcha.getResponse();但事实并非如此。显然,recaptcha在网站上运作良好,但我刚刚在Google管理员中看到了下一条消息: 在此处输入图片说明

要求: 1.不要action="file.php"在表单中使用,仅在表单中使用javascript函数。

     <!DOCTYPE>
<html>
<head >
    <title></title>
    <script src='https://www.google.com/recaptcha/api.js'></script>
    <script type="text/javascript">
        function get_action() {
            var v = grecaptcha.getResponse();
            console.log("Resp" + v );
            if (v == '') {
                document.getElementById('captcha').innerHTML = "You can't leave Captcha Code empty";
                return false;
            }
            else {
                document.getElementById('captcha').innerHTML = "Captcha completed";
                return true;
            }
        }
    </script>
</head>
<body>
    <form id="form1" onsubmit="return get_action();">
    <div>
    <div class="g-recaptcha" data-sitekey="6LdNIlAUAAAAADS_uVMUayu5Z8C0tw_jspdntbYl"></div>
    </div>
   <input type="submit" value="Button" />
   
    <div id="captcha"></div>
    </form>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

请你帮我一下。我将不胜感激,如何验证它,因为我需要使用javascript函数onsubmit="return get_action();"而不是 …

javascript php ajax recaptcha invisible-recaptcha

4
推荐指数
1
解决办法
8024
查看次数

标签 统计

ajax ×1

invisible-recaptcha ×1

javascript ×1

php ×1

recaptcha ×1