Jquery verifies the user name (ajax verifies whether the user name exists)

Source: Internet
Author: User

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.
*/


%>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.