首页 > 解决方案 > Javascript - 成功验证后的 google ReCaptcha V2 执行功能

问题描述

到目前为止,这是我的代码:

<script type="text/javascript">

var widgetId1;
var onloadCallback = function() {

    widgetId1 = grecaptcha.render('le_captcha', {
      'sitekey' : 'xxx',
      'theme' : 'light'
    });
};


function check(){
    alert(grecaptcha.getResponse(widgetId1));
}

function executeMeAfterSuccessfullValidation(){
    alert('user passed');
}
</script>


<button onclick="check()">check if passed</button>

<div id="le_captcha"></div>

我想executeMeAfterSuccessfullValidation在用户成功验证后被调用。

他们的文档中没有任何内容如何做到这一点:https ://developers.google.com/recaptcha/docs/display

但我见过一些网站这样做。如何?

提前致谢

标签: javascriptjqueryrecaptcha

解决方案


推荐阅读