Use the JQuery plug-in validate Remote, jqueryvalidate
JQuery. validate. js is often used in Form Verification. For Beginners, refer to the instructions for using Remote.
1. Basic explanation
JQuery is mainly used for DOM tree and CSS tree retrieval and subsequent operations. validate. js is a plug-in for JQuery and can be considered as an extension of JQuery in a special scenario. Validate is an extension provided for form verification.
2. Scenario explanation
When registering a user, the user needs to asynchronously determine whether the user name exists and give a prompt.
3. Use Case Studies
Html and JavaScript scripts.
1 <! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN "" http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> 2
Background PHP code BaseFunction. php
<?php function WriteLog($msg) { $filename = dirname(__FILE__) ."\\Debug.log"; $handler = null; if (($handler = fopen($filename, 'ab+')) !== false) { fwrite($handler, "\n".'['.date('Y-m-d H:i:s').']'."\t".$msg); fclose($handler); } } function CheckUser($UserName) { if( $_REQUEST[$UserName] == 'php' ){ exit("false"); } else{ exit("true"); } }?>
PHP code Learn. php In the background
<?php require("BaseFunction.php"); CheckUser('firstname');?>