Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use jQuery+Ajax to determine whether the input CAPTCHA is correct

Shulou Source: shulou.com Published: 2022-06-01 02:43:13 09月22日 Update

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

Tags: Validation content input code articles knowledge articles values pictures most that is more steps knowledge points industry information information channels channels help Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi macOS Docker vpn Microsoft