看不见的reCAPTCHA加载

时间:2018-12-12 19:33:23

标签: javascript jquery invisible-recaptcha

我有一个不可见的reCAPTCHA,可以在加载时工作,但是,我不明白如何实现g-recaptcha-response。谁能帮我吗?用户提交reCAPTCHA时,我需要一个POST参数。

    <head>
   <script src='https://www.google.com/recaptcha/api.js' async defer></script>

    <script>
        function onSubmit(){
            console.log("Submitted");
        }

        function loadCaptcha(){
            console.log("loaded");
            setTimeout(function(){grecaptcha.execute()},2000)
        }

    </script>

</head>

<body onload="grecaptcha.execute();console.log('LOADED')">

<div class="g-recaptcha"
     data-sitekey="xxxxxxxxxxxxxxxxxxxxxxxxx"
     data-callback="onSubmit"
     data-size="invisible">
</div>

</body>

0 个答案:

没有答案