验证码AJAX API +自定义主题不工作 [英] reCAPTCHA Ajax API + custom theme not working

查看:104
本文介绍了验证码AJAX API +自定义主题不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看不到我要去哪里错了。我已经试过所有我能想到的,验证码是不工作的AJAX API。下面是我的code是这样的:

 <! - 这是与< HEAD> - >
<脚本类型=文/ JavaScript的SRC =HTTP://$c$c.jquery.com/jquery-1.4.2.min.js>< / SCRIPT>
<脚本类型=文/ JavaScript的SRC =htt​​p://api.recaptcha.net/js/recaptcha_ajax.js>< / SCRIPT>
<脚本类型=文/ JavaScript的>
$(文件)。就绪(函数(){
    Recaptcha.create(我这里的关键,recaptcha_widget,{
        主题:自定义,
        郎:恩,
        回调:函数(){执行console.log(回调); } //这不会被调用
    });
});
< / SCRIPT>
<  - !...这是与<身体GT; - >
< D​​IV ID =recaptcha_widget的风格=显示:无>
    < D​​IV ID =recaptcha_image>< / DIV>
    < D​​IV 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>
    < D​​T>键入单词< / DT>
    < D​​D><输入类型=文本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> &bull;
        <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> &bull;
        <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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆