<body>$ (document). Ready (function(e) {//determine if the user name is available$ ("#user"). Blur (function(){varUID = $ (this).Val (); $.Ajax ({URL: "Chuli.php",Data: {u:uid,type:1},type: "POST",datatype: "TEST"Success:function(d) {if (d== "OK")
{
$ ("$ts"). HTML ("User name available");
}
Else
{
$ ("#ts"). HTML ("<span style= ' color=red ' > The user name already exists </span>");
}}});})});</script>
chuli.php
<?php//do not have an empty top to write$type=$_post["Type"];include"Dbda.php";$db=NewDbda ();Switch(){ Case0:$uid=$_post["U"];//Receive$pwd=$_post["P"];$sql= "SELECT count (*) from login where Username= ' {$uid} ' and password= ' {$pwd}‘";$attr=$db->query ($sql);if($attr[0] [0]==0){Echo"User name password is incorrect";}Else{Echo"OK";} Break; Case1:$uid=$_post["U"];$sql= "SELECT count (*) from login where Username= ' {$uid}‘";$attr=$db->query ($sql);if($attr[0] [0]==0){Echo"OK";}Else{Echo"NO";} Break;}
PHP language--Ajax registered user name is available