整合和验证隐形验证码

时间:2019-06-20 03:19:08

标签: javascript php html recaptcha invisible-recaptcha

我想将Recaptcha添加到表单中,我为它注册并获取了密钥。

<form>
    <input type="text" name="name" /> 
    <input type="email" name="email" />
    <textarea name="message"></textarea>
    <input type="submit" name="submit" value="Send" />
</form>

然后我将此代码添加到页面:

<script src='https://www.google.com/recaptcha/api.js?render=My_Website_Key'></script>

接下来,我添加了以下Javascript / Jquery代码:

//When page is loaded.
$(document).ready(function() { 

    grecaptcha.ready(function() {

        grecaptcha.execute('The Website Key', {action: 'homepage'}).then(function(token) {});

    }); //Recaptcha ready

}); //Page is loaded

最后,我正在尝试验证,但是没有隐藏元素要使用值或要发送给后端进行检查的任何内容。

那么如何从后端检查?

1 个答案:

答案 0 :(得分:0)

看看: https://developers.google.com/recaptcha/docs/invisible

您可以将其链接到“提交”按钮,并将其链接到输入字段

相关问题