使用jQuery/AJAX/PHP轻松设置验证码
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了使用jQuery/AJAX/PHP轻松设置验证码相关的知识,希望对你有一定的参考价值。
These days when you are using forms you need some sort of protection from bots and spammers.
//Validate the Recaptcha' Before continuing with POST ACTION function validateCaptcha() { challengeField = $("input#recaptcha_challenge_field").val(); responseField = $("input#recaptcha_response_field").val(); type: "POST", data: "form=signup&recaptcha_challenge_field=" + challengeField + "&recaptcha_response_field=" + responseField, async: false }).responseText; //console.log( html ); if(html == "success") { //Add the Action to the Form $("form").attr("action", "../php/db-process-form.php"); $("#submit").attr("value", "Submit"); //Indicate a Successful Captcha $("#captcha-status").html("<p class="green bold">Success! Thanks you may now proceed.</p>"); } else { $("#captcha-status").html("<p class="red bold">The security code you entered did not match. Please try again.</p>"); Recaptcha.reload(); } }
以上是关于使用jQuery/AJAX/PHP轻松设置验证码的主要内容,如果未能解决你的问题,请参考以下文章
(进阶篇)jQuery+Ajax+PHP+Mysql实现分页显示数据
带有 PHPMailer 的 jQuery AJAX + PHP 表单
复选框状态更改时如何更新mysql字段?使用 jquery (ajax)、php 和 mysql