使用 jquery .load() 时未生成 reCaptcha
我有以下代码。
标记
<nav id=main>
<ul>
<li><a id=home href="#">Home</a></li>
<li><a id=about href="#">About</a></li>
<li><a id=contact href="#">Contact</a></li>
</ul>
</nav>
<div id="page"></div>
Javascript
$(function() {
$('nav#main ul li a').click( function() {
var page = $(this).attr("id");
$('div#page').load("pages/"+page+".php");
});
});
在联系页面中,我在表单中集成了 reCaptcha。
也可以直接使用 URL www.mydomain.com/?page=contact
访问联系页面。通过在地址栏中输入 URL 来访问该页面时,reCaptcha 显示正常。但是,当使用我上面提供的 javascript 从导航和处理中单击 contact
链接时,reCaptcha 不会显示。
page.php
<div>
<form>
<?php
require_once($captchaPath);
$publickey = "key"; // you got this from the signup page
echo recaptcha_get_html($publickey);
?>
<button name="send" type="button" value="Send">Send</button>
</form>
</div>
可能是什么问题?
I've the following codes.
Mark Up
<nav id=main>
<ul>
<li><a id=home href="#">Home</a></li>
<li><a id=about href="#">About</a></li>
<li><a id=contact href="#">Contact</a></li>
</ul>
</nav>
<div id="page"></div>
Javascript
$(function() {
$('nav#main ul li a').click( function() {
var page = $(this).attr("id");
$('div#page').load("pages/"+page+".php");
});
});
In the contact page, I've integrated reCaptcha in a form.
The contact page can be accessed using the URL www.mydomain.com/?page=contact
directly also. While accessing the page by typing the URL in the address bar, the reCaptcha shows up fine. But when clicked on the contact
link from the navigation and processing using the javascript I've provided above, the reCaptcha doesn't show up.
page.php
<div>
<form>
<?php
require_once($captchaPath);
$publickey = "key"; // you got this from the signup page
echo recaptcha_get_html($publickey);
?>
<button name="send" type="button" value="Send">Send</button>
</form>
</div>
What can be the problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尚未查看您的代码,但 Recaptcha 已更新其 网址。只是想建议这是否可能是问题所在。
您需要将 https://api-secure.recaptcha.net 更新为 https://www.google.com/recaptcha/api
Haven't gone through your code, but Recaptcha has updated their URL. Just wanted to suggest if that could be the problem.
You need to update the https://api-secure.recaptcha.net to https://www.google.com/recaptcha/api
也许我错了,但我认为你想加载页面“contact.php”、“home.php 和/或“about.php”。您不创建任何参数。
maybe I'm wrong, but I think you want to load the page 'contact.php', 'home.php and/or 'about.php'. you don't create any parameter.