代码之家  ›  专栏  ›  技术社区  ›  TheGreatCornholio

Javascript-google ReCaptcha V2验证成功后执行函数

  •  1
  • TheGreatCornholio  · 技术社区  · 7 年前

    这是我目前的代码:

    <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

    提前谢谢

    0 回复  |  直到 7 年前