Jquery to verify the user name (ajax to verify whether the user name exists) Below we will provide a jquery plug-in to verify the user name. Here we use jquery ajax to verify whether the user name exists.
Jquery verifies the user name (ajax verifies whether the user name exists)
Here we will provide a jquery plug-in to verify the user name. Here we use jquery ajax to verify whether the user name exists.
%>
<% @ Page language = "c #" contenttype = "text/html" responseencoding = "gb2312" %>
<! Doctype html public "-// w3c // dtd xhtml 1.0 transitional // en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<Html xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Meta http-equiv = "content-type" content = "text/html; charset = gb2312"/>
<Title> jquery authentication username (ajax authentication username exists) </title>
<Script type = "text/Webpage effects" src = "css tutorial/jquery-1.3.2. webpage effects"> </script>
<Script type = "text/javascript">
Function judgeusername ()
{
$. Ajax ({
Type: "get ",
Url: "www. bKjia. c0m. asp tutorial x ",
Datatype: "html ",
Data: "username =" + $ ("# txtname"). val (),
Beforesend: function (xmlhttprequest)
{
$ ("# Showresult"). text ("querying ");
// Pause (this, 100000 );
},
Success: function (msg)
{
$ ("# Showresult" cmd.html (msg );
$ ("# Showresult" ).css ("color", "red ");
},
Complete: function (xmlhttprequest, textstatus)
{
// Hide the picture being queried
},
Error: function ()
{
// Handle errors
}
});
}
</Script>
</Head>
<Body>
<Div>
<Input id = "txtname" type = "text"/> <input type = "button" value = "check whether the user name exists" id = "btn" onclick = "judgeusername (); "/>
<Div id = "showresult" style = "float: left"> </div>
</Div>
</Body>
</Html>
<%
Protected void page_load (object sender, eventargs e)
{
String username = request. querystring ["username"]. tostring ();
If (username = "james hao ")
{
Response. write ("the user name already exists! ");
}
Else
{
Response. write ("You can use this user name! ");
}
}
/*
Asynchronous Refresh can be implemented in multiple ways. You can also use multiple js frameworks. The following describes how to use ajax implemented by the jquery framework to verify whether the user name exists.
*/
%>