不知道如何主题ajax加载recaptcha.以下代码不起作用
从 Google Recaptcha
从 Google Recaptcha
看到这个帖子Recaptcha ajax API custom theme not working,但我绝对在localhost和recaptcha观看工作正常,只是不改变主题.
任何人都有如何使白色主题工作的建议?
<script type='text/javascript'> var RecaptchaOptions = { theme : 'white' }; </script> <div id="recaptcha_content"> <noscript> <iframe src="http://www.google.com/recaptcha/api/noscript?k=6Ldr7woAAAAAADa_69Mr-EZKAeYyEx9N08q" height="300" width="500" frameborder="0"></iframe><br /> <textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea> <input type='hidden' name='recaptcha_response_field' value='manual_challenge' /> </noscript> </div> <script type="text/javascript"> $(document).ready(function() { $.getScript('http://www.google.com/recaptcha/api/js/recaptcha_ajax.js',function() {Recaptcha.create("6Ldr7woAAAAAADa_69Mr-EZKAeYyEx9N08q","recaptcha_content"); }); }); </script>
解决方法
我不会像你添加你设置了RecapthcaOptions的选项.尝试改为:
$.getScript('http://www.google.com/recaptcha/api/js/recaptcha_ajax.js',"recaptcha_content",RecaptchaOptions); });
See the doc’s,传递给.create()方法的第三个选项是选项.您正在函数外设置一个变量来设置选项,但不包括它们.