谷歌Recaptcha2 Laravel刀片到html注入错误

时间:2016-12-10 05:28:53

标签: html laravel captcha

当我将一个laravel刀片模式注入到html页面时,我在html页面中加载了recaptcha 2。

var widgetId;

    var onloadCallback = function() {
    console.log("footer captcha");

    if(typeof grecaptcha != "undefined" && widgetId == null ){
        widgetId = grecaptcha.render('recaptcha', {
            'theme': 'light',
            'sitekey' : 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
        });
    }
    if(typeof childCaptchaCallback != "undefined"){
        childCaptchaCallback();
    }
};

并加载了recaptcha script.Html有一个表单和JQvalidation。在验证html后,打开弹出模式(laravel blade)并在模态中验证(它可以工作 - jQuery验证)。关闭该模态并在该html页面中,jQuery验证在下次提交点击时失败。

我想当我加载recapt的api.js脚本时。 (Grecaptcha是验证码的对象,用于获取和重置验证码)。但是如果我打开一个laravel刀片并尝试验证grecaptcha,那么它就是包含验证码的laravel页面的对象。关闭弹出窗口后,grecaptcha将成为html页面的对象。但是当调用grecaptcha.getResponse()函数时,它会显示错误"无效的recaptcha客户端ID未定义"。

0 个答案:

没有答案