ReCAPTCHA找不到用户提供的功能:myCallBack [英] ReCAPTCHA couldn't find user-provided function: myCallBack
本文介绍了ReCAPTCHA找不到用户提供的功能:myCallBack的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用ReCAPTCHA,因为我遇到以下错误。
I'm trying to use ReCAPTCHA where I am getting following error.
ReCAPTCHA无法找到用户提供的功能:myCallBack 。
ReCAPTCHA couldn't find user-provided function: myCallBack.
如何解决这个问题?
var verifyCallback3 = function(response) {
if(response!=null){
$("#rss").show();
}
};
var myCallBack = function() {
grecaptcha.render('html_element', {
'sitekey' : '6sssfffffffffAAPfEI_RkbAlUuw5FA4p-kiGy5Nea',
'callback' : verifyCallback3,
'theme' : 'light',
'type':'image'
});
};
推荐答案
确保在全球范围内定义回调函数范围。出于某种原因,在生产中我的函数不在此命名空间中。
Make sure your callback function is being defined in the global scope. For some reason, in production my function was not in this namespace.
除了:
function myCallback() { ... }
确保直接指定它进入全球空间:
Make sure you directly assign it into the global space:
window.myCallback = myCallback;
您应该能够测试这是否是您的问题,我在Javascript控制台输入函数名称并查看它是否已定义。
You should be able to test whether this is your problem, my typing the function name at the Javascript console and seeing if it's defined or not.
这篇关于ReCAPTCHA找不到用户提供的功能:myCallBack的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文