reCAPTCHA Ajax API自定义主题不起作用

前端之家收集整理的这篇文章主要介绍了reCAPTCHA Ajax API自定义主题不起作用前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我看不出我哪里出错了.我已经尝试了我能想到的一切,reCAPTCHA只是没有使用Ajax API.这是我的代码的样子:
<!-- 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>
对我有用吗?怎么了?你想做什么?

当我替换并警告console.log时,它会在每次加载页面生成新的reCaptcha时改变.完全像它应该的.

回调不是您提交验证的地方,如果您正在尝试这样做,请查看此处:http://recaptcha.net/apidocs/captcha/

原文链接:https://www.f2er.com/ajax/159993.html

猜你在找的Ajax相关文章