Google reCAPTCHA 中未捕获的类型错误
我正在通过 JavaScript 加载 reCAPTCHA http://www.google.com/recaptcha/api/js/recaptcha_ajax.js 和我使用 jquery-1.5.2.min.js 与本地 PHP 脚本进行通信,然后通过 Google 的 recapchalib.php 验证输入,并将数据以 JSON 格式返回到 JavaScript。 一切正常,但 Google Chrome 的控制台报告错误:
Uncaught TypeError: Cannot set property 'innerHTML' of null recaptcha_ajax.js:15
Recaptcha._init_builtin_theme recaptcha_ajax.js:15
Recaptcha._finish_widget recaptcha_ajax.js:19
Recaptcha.challenge_callback recaptcha_ajax.js:13
(anonymous function) challenge:12
我想解决该错误,但我不知道如何解决。
I'm loading reCAPTCHA via JavaScript
http://www.google.com/recaptcha/api/js/recaptcha_ajax.js and am using jquery-1.5.2.min.js to communicate with a local PHP script which then validates the input via Google's recaptchalib.php and returns data to the JavaScript in JSON format.
It all works, but Google Chrome's Console reports an error:
Uncaught TypeError: Cannot set property 'innerHTML' of null recaptcha_ajax.js:15
Recaptcha._init_builtin_theme recaptcha_ajax.js:15
Recaptcha._finish_widget recaptcha_ajax.js:19
Recaptcha.challenge_callback recaptcha_ajax.js:13
(anonymous function) challenge:12
I would like to resolve that error but I don't know how to go about it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
也许您正在向它传递一个不存在的元素来实例化自己。您确定没有拼错
id
或类似的内容吗?Perhaps you're passing it a nonexistent element to instantiate itself in. Are you sure you didn't misspell an
id
or something like that?这一切都与您要在其中创建 reCaptcha 的 div 的
id
相关。检查id
是否正确。在创建 reCpatcha 之前,检查该 id 是否确实存在:It's all about the
id
of the div where you want to create the reCaptcha. Check if theid
is correct. And before create the reCpatcha, check if thatid
really exists: