How to use jQuery+Ajax to determine whether the input CAPTCHA is correct
Most people do not understand the knowledge points of this article "how to use jQuery+Ajax to determine whether the input CAPTCHA is correct", so the editor summarizes the following contents, detailed contents, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "how to use jQuery+Ajax to determine whether the input CAPTCHA is correct" article.
The specific code is as follows:
$(document) .ready (function (e) {$('# yes'). Hide (); $('# no'). Hide ()) .keyup (function () {if ($(this). Val (). Length = = 4) {$.post ('gbook.php', {cc:$ (' input [name = gcode]'). Val ()}, function (msg) {if (msg=='yes') {$('# no'). Hide () $('# yes'). Show ();} else {$('# yes') .hide (); $("# no") .show ();}});});})
First, jquery is introduced.
.sl-error-verifycode {background-image: url ("images/icons.png"); background-position:-26px 0; background-repeat: no-repeat; display: block; font-size: 18px; height: 23px; line-height: 20px; margin-left: 180px; margin-top:-25px; position: relative; text-align: center; width: 20px; z-index: 2;} .sl-correct-verifycode {background-image: url ("images/icons.png"); background-position:-50px 0 Background-repeat: no-repeat; display: block; font-size: 18px; height: 23px; line-height: 20px; margin-left: 180px; margin-top:-25px; position: relative; text-align: center; width: 20px; z-index: 2;}
Html code of the CAPTCHA
CAPTCHA: *
Gbook.php