简体   繁体   English

如何使用Ajax验证Recaptcha?

[英]How can i validate recaptcha with ajax?

my function in js have this code: 我在js中的函数具有以下代码:

$.ajax({
                                url: "ajax.php",
                                type: 'POST',
                                data: 'act=newAccount&email=' + email + '&password=' + password  + '&first-name=' + firstName + '&last-name=' + lastName + '&company-name=' + companyName,
                                success: function(data) 
                                {
                                    json = JSON.parse(data);
                                    if (json === true)
                                    {
                                        console.log("data");
                                        $("#new-account-form")[0].reset();
                                        window.location.replace('login.php');
                                    }
                                    else
                                    {
                                        $(".error-message span").html('Your regestry failed. Please, insert valid data.');
                                        $('.error-message').fadeIn('slow', function () {
                                            $('.error-message').delay(5000).fadeOut('slow');
                                        });
                                    }
                                }
                            });

now, i want validate recaptha in my ajax.php but i dont know how i do... 现在,我想在我的ajax.php中验证recaptha,但我不知道该怎么做...

thanks you all 谢谢大家

You'll need a Captcha images' displayer and some code to validate it. 您将需要验证码图像的显示器和一些代码来对其进行验证。 I recommend Securimage , it worked fine for me, and it is so easy to implement. 我推荐Securimage ,它对我来说很好用,并且很容易实现。 Have a look at it at http://www.phpcaptcha.org/documentation/quickstart-guide/ http://www.phpcaptcha.org/documentation/quickstart-guide/上查看一下

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM