Javascript &引用;未捕获类型错误:无法读取属性';儿童';“无效”的定义;重置google recaptcha时出错
下面是我如何将google recaptcha呈现到指定的容器中(我在一个页面上有4个google recaptcha,每个表单上有一个) 调用GoogleRecaptchaAPIJavascript &引用;未捕获类型错误:无法读取属性';儿童';“无效”的定义;重置google recaptcha时出错,javascript,jquery,recaptcha,Javascript,Jquery,Recaptcha,下面是我如何将google recaptcha呈现到指定的容器中(我在一个页面上有4个google recaptcha,每个表单上有一个) 调用GoogleRecaptchaAPI <script src="https://www.google.com/recaptcha/api.js?onload=myCallBack&render=explicit" async defer></script> 因此,正如您从上面的参考中所看到的,如果响应数据内容为“true
<script src="https://www.google.com/recaptcha/api.js?onload=myCallBack&render=explicit" async defer></script>
因此,正如您从上面的参考中所看到的,如果响应数据内容为“true”,则重置google recaptcha,但不幸的是,它不起作用,相反,我得到了这个错误“Uncaught TypeError:无法读取null的属性‘children’”。有什么想法、帮助、线索、建议、建议吗?
grecaptcha.reset(widgetId”);
这里有一个“
双引号。这是打字错误还是什么?@Jai:糟糕,谢谢你指出,这是一个错误的打字,不管怎样,我删除了双qoute,但仍然无法工作。有什么想法吗?grecaptcha.reset(widgetId”);
这里有一个“
双引号。这是打字错误还是什么?@Jai:糟糕,谢谢你指出,这是一个错误的打字,不管怎样,我删除了双qoute,但仍然无法工作。有什么想法吗?
<script>
var recaptcha_susu;
var recaptcha_payrollloan;
var recaptcha_sme;
var recaptcha_personalloan;
var myCallBack = function() {
recaptcha_susu = grecaptcha.render('recaptcha_susu', {
'sitekey' : 'mysitekey', //Replace this with your Site key
});
recaptcha_payrollloan = grecaptcha.render('recaptcha_payrollloan', {
'sitekey' : 'mysitekey', //Replace this with your Site key
});
recaptcha_sme = grecaptcha.render('recaptcha_sme', {
'sitekey' : 'mysitekey', //Replace this with your Site key
});
recaptcha_personalloan = grecaptcha.render('recaptcha_personalloan', {
'sitekey' : 'mysitekey', //Replace this with your Site key
});
};
</script>
$("#sme_application_dialog form").submit(function(e){
//validate the captcha
$.ajax({
url : $("body").attr("data-link") + "/validate-recaptcha",
data: $(this).serialize(),
type: 'post',
beforeSend: function(){
$(".whiteblur").fadeIn(200, function(){
$(".windows8").show();
});
},
complete: function(){
$(".whiteblur").fadeOut(200, function(){
$(".windows8").hide();
});
$('#recaptcha_reload').click();
},
success: function(data){
if($.trim(data) === "true"){ //this is the part of resetting the form
var widgetId = grecaptcha.render("#recaptcha_sme");
grecaptcha.reset(widgetId);
}else{
}
}
});
//end validation
e.preventDefault();
});