不确定为什么会这样。在回发时,验证码消失了,因此在阅读了一些文章之后,我获得了以下代码来解决问题(在回发后,验证码仍然显示)
<script src="https://www.google.com/recaptcha/api.js?onload=**pageLoad**&render=explicit"></script>
<asp:ScriptManager runat="server" ID="sm1"></asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="col-xs-12">
<div class="g-recaptcha" data-sitekey="XXXXXXXX"></div>
<script language="javascript" type="text/javascript">
function pageLoad() {
$('.g-recaptcha').each(function (index, obj) {
grecaptcha.render(obj, { 'sitekey': 'XXXXXXXX' });
});
}
</script>
但是在控制台窗口(Chrome)中,我看到了错误
Uncaught TypeError: grecaptcha.render is not a function
at HTMLDivElement.<anonymous> ((index):468)
at Function.each (jquery.min.js:2)
at n.fn.init.each (jquery.min.js:2)
at pageLoad ((index):467)
因此将pageLoad更改为onloadCallback
<script src="https://www.google.com/recaptcha/api.js?onload=onloadCallback&render=explicit"></script>
哪个错误可以解决,但是我单击按钮时验证码消失了(表单上的验证问题)?
按照这些文章中的步骤进行操作,但不确定即时通讯在哪里出错? noCAPTCHA reCAPTCHA disappearing in UpdatePanel Recaptcha in Updatepanel disappears during PostBack