错误:ReCAPTCHA占位符元素必须为空 [英] Error: ReCAPTCHA placeholder element must be empty

查看:592
本文介绍了错误:ReCAPTCHA占位符元素必须为空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在laravel应用程序中使用了Recaptcha.

I am using recaptcha with my laravel application.

我只想使用jquery检查表单提交时Recaptcha的响应,并通过提醒验证验证码来停止用户.

I just want to check recaptcha's response on form submit using jquery and stop user by alert that pleade validate captcha.

但是,即使没有填写验证码,我也无法停止提交表单.

but , I could not stop form submission even if captcha is not filled.

这是我的代码.

 $('#payuForm').on('submit', function (e) {

                    var response = grecaptcha.getResponse();

                    if(response.length == 0 ||  response == '' || response ===false ) {
                        alert('Please validate captcha.');
                        e.preventDefault();
                    }
                });



<div class="captcha">
 {{ View::make('recaptcha::display') }}
</div>

我在浏览器控制台中遇到此错误,并且表单被提交.

I am getting this error in browser console , and form gets submit.

Error: ReCAPTCHA placeholder element must be empty

推荐答案

您正在两次加载Google Recaptcha库.

You are loading the google recaptcha library twice.

https://www.google.com/recaptcha/api.js

这篇关于错误:ReCAPTCHA占位符元素必须为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆