我如何可以加载使用jQuery / AJAX而留下的ReCaptcha脚本代替验证码的形式? [英] How can I load a reCaptcha form using jQuery/AJAX while leaving the reCaptcha scripts in place?

查看:232
本文介绍了我如何可以加载使用jQuery / AJAX而留下的ReCaptcha脚本代替验证码的形式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我打开我的联系方式到我与jQuery / AJAX页面。

I load my contact form into my page with JQuery/AJAX.

联系表格包含的ReCaptcha脚本。

The contact form contains the reCaptcha scripts.

不幸的是,JQuery的删除脚本标记将它们插入到我的网页了。这些脚本标记是需要的,因为他们输出的验证码。现在我装的形式有没有验证码。

Unfortunately, JQuery removes the script tags before inserting them into my page. These script tags are needed because they output the captcha. now my loaded form has no captcha.

推荐答案

链接有你所需要的:<一href="http://$c$c.google.com/apis/recaptcha/docs/display.html">http://$c$c.google.com/apis/recaptcha/docs/display.html

您不能添加AJAX脚本。您应该添加以下行之前:

You can't add the script in ajax. You should add the following line before :

  <script type="text/javascript" src="http://www.google.com/recaptcha/api/js/recaptcha_ajax.js"></script>

然后,您可以动态地在你的js code通过添加以下code创建一个验证码的形式:

Then, you can dynamically create a recaptcha form in your js code by using adding the following code:

  Recaptcha.create("your_public_key",
    "element_id",
    {
      theme: "red",
      callback: Recaptcha.focus_response_field
    }
  );

这篇关于我如何可以加载使用jQuery / AJAX而留下的ReCaptcha脚本代替验证码的形式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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