我遇到了一个问题,实现联系人窗体上的验证码控制。
I am running into an issue with implementing the reCaptcha control on a contact form.
下面的错误会被抛出负载:未捕获的ReferenceError:验证码没有定义的
The following error is thrown on load: Uncaught ReferenceError: Recaptcha is not defined
下面是我使用的code部分片段:
Here is a partial snippet of the code I am using:
<form role="form" id="ContactMessageForm">
<div class="form-group">
<div id="CaptchaContainer"></div>
</div>
<button type="button" class="btn btn-default" id="ContactMessageSendButton">Send</button>
</form>
<script type="text/javascript" src="/scripts/mail.min.js" defer="defer"></script>
<script type="text/javascript" src="http://www.google.com/recaptcha/api/js/recaptcha_ajax.js"></script>
<script type="text/javascript">
$(document).ready(function () {
/* Initialize reCaptcha Control */
Recaptcha.destroy();
Recaptcha.create('6Lc4V_ASAAAAAMnnwUcaTewH1mlOdylMgAyxb_m6', 'CaptchaContainer', {
theme: 'clean',
callback: Recaptcha.focus_response_field
});
});
</script>
目前最有可能在我的code笔误,但我只是没有看到它。
There is most likely a typo in my code, but I am just not seeing it.
您可以看到实际的错误,在被解雇:的http:// eat-睡眠 - code.com /#!/联系人
You can see the actual error get fired at: http://eat-sleep-code.com/#!/contact
我有同样的问题,我固定它具有以下
I have had the same problem and i fixed it with following
<script type="text/javascript">
$.getScript( "http://www.google.com/recaptcha/api/js/recaptcha_ajax.js", function() {
Recaptcha.create("<PUBLIC_KEY>", "recaptchadiv", {theme: "clean"});
});
</script>