Google ReCaptcha 2自动提交 [英] Google ReCaptcha 2 auto submit

查看:66
本文介绍了Google ReCaptcha 2自动提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的用户将在网页中看到一个google repcatcha2(nocaptcha).当他们解决验证码(在方框中打勾)时,应自动提交表单.

My users will see a google repcatcha2 (nocaptcha) in a web page. When they solve the captcha (put the tick in the box) the form should be automatically submit.

有什么办法吗?

推荐答案

当然可以.在这篇文章中,我解释了如何将reCaptcha插入网站并编写JavaScript代码以验证用户和网站.

Sure you can do it. In this post I've explained how to insert reCaptcha into a site and to code javascript to verify user and site.

  1. 使用reCaptcha向您的表单添加名称:< form method ="post" name ="myform">

添加 document.myform.submit(); 代码以在站点验证成功事件后提交表单:

Add document.myform.submit(); code for submitting of the form upon the site verification success event:

<script type='text/javascript'>    
  var onReturnCallback = function(response) { 
    var url='proxy.php?url=' + 'https://www.google.com/recaptcha/api/siteverify';  
    $.ajax({ 'url' : url, 
               dataType: 'json',
               data: { response: response},
               success: function( data  ) {  
                    var res = data.success.toString(); 
                    if (res)
                       { document.myform.submit(); }    
                }  // end success 
           });  // end $.ajax

  };  // end onReturnCallback
</script>

这篇关于Google ReCaptcha 2自动提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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