验证码AJAX API +自定义主题不工作 [英] reCAPTCHA Ajax API + custom theme not working
问题描述
我看不到我要去哪里错了。我已经试过所有我能想到的,验证码是不工作的AJAX API。下面是我的code是这样的:
<! - 这是与< HEAD> - >
<脚本类型=文/ JavaScript的SRC =HTTP://$c$c.jquery.com/jquery-1.4.2.min.js>< / SCRIPT>
<脚本类型=文/ JavaScript的SRC =http://api.recaptcha.net/js/recaptcha_ajax.js>< / SCRIPT>
<脚本类型=文/ JavaScript的>
$(文件)。就绪(函数(){
Recaptcha.create(我这里的关键,recaptcha_widget,{
主题:自定义,
郎:恩,
回调:函数(){执行console.log(回调); } //这不会被调用
});
});
< / SCRIPT>
< - !...这是与<身体GT; - >
< DIV ID =recaptcha_widget的风格=显示:无>
< DIV ID =recaptcha_image>< / DIV>
< DIV ID =recaptcha_links>
< A HREF =JavaScript的:Recaptcha.reload()>再弄< / A> &功放;公牛;
<一类=recaptcha_only_if_image的href =JavaScript的:Recaptcha.switch_type('声音')>切换到音频< / A>
<一类=recaptcha_only_if_audio的href =JavaScript的:Recaptcha.switch_type(图像)>切换到图片< / A> &功放;公牛;
< A HREF =JavaScript的:Recaptcha.showhelp()>帮助< / A>
< / DIV>
< DT>键入单词< / DT>
< DD><输入类型=文本ID =recaptcha_response_fieldNAME =recaptcha_response_field>< / DD>
< / DIV>
对不起,再回答我的问题。发现问题,显然不能在本地存储的文件中使用验证码(通过访问的文件:///
),他们必须在一个 HTTP://
网站。当我把这个在本地主机上,它的工作。
+1 durilai让我知道它的工作原理与他/她,这样我就能够看问题,从不同的角度。
I can't see where I'm going wrong. I've tried everything I could think of, reCAPTCHA is just not working with the Ajax API. Here's what my code looks like:
<!-- this is in <head> -->
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="http://api.recaptcha.net/js/recaptcha_ajax.js"></script>
<script type="text/javascript">
$(document).ready(function() {
Recaptcha.create("my key here", "recaptcha_widget", {
"theme": "custom",
"lang": "en",
"callback": function() { console.log("callback"); } // this doesn't get called
});
});
</script>
<!-- ... this is in <body> -->
<div id="recaptcha_widget" style="display: none">
<div id="recaptcha_image"></div>
<div id="recaptcha_links">
<a href="javascript:Recaptcha.reload()">get another</a> •
<a class="recaptcha_only_if_image" href="javascript:Recaptcha.switch_type('audio')">switch to audio</a>
<a class="recaptcha_only_if_audio" href="javascript:Recaptcha.switch_type('image')">switch to image</a> •
<a href="javascript:Recaptcha.showhelp()">help</a>
</div>
<dt>Type the words</dt>
<dd><input type="text" id="recaptcha_response_field" name="recaptcha_response_field"></dd>
</div>
Sorry for answering my question again. Found the problem, apparently you can't use reCAPTCHA in locally stored files (accessed via file:///
), they have to be on a http://
site. As soon as I put this on localhost it worked.
+1 durilai for letting me know it works with him/her, this way I was able to look at the problem from a different perspective.
这篇关于验证码AJAX API +自定义主题不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!