切换到隐形验证码

时间:2019-05-02 21:44:27

标签: javascript php html css invisible-recaptcha

我想将带框的Recaptcha切换到一个不带验证码的简单按钮..参见我的代码

<?php if(isset($_POST['submit'])) { ?>
INVISIBLE CONTENT... APPERS AFTER RESOLVE CAPTCHA
<?php } else { ?>

<script src='https://www.google.com/recaptcha/api.js'></script>
    <form action="" method="post" onsubmit="return validar()">
        <div class="g-recaptcha" data-callback="recaptchaCallback" data-sitekey="my-site-key"></div>
            <button class="btn btn-primary" type="submit" name="submit">VerFilme</button>
    </form>
<script>

googlerecpchk = false;

function recaptchaCallback() {
    googlerecpchk = true;
};

function validar(){
    console.log(googlerecpchk);
    if(!googlerecpchk){
        alert("reCaptcha inválido!");
        return false;
    }
}
</script><?php }?>

0 个答案:

没有答案