Implementation Code for verifying the existence of user names based on AJAX implemented by jquery

Source: Internet
Author: User

Instance:
1. Request Ajax. aspx
Html Code Copy code The Code is as follows: <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>

JS Code copy Code the code is as follows:

2. Page ajaxuserinfomodify. aspx
Background codeCopy codeThe Code is as follows: 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! ");
}
}

3 , Running interface

(1) initialization Interface

(2) Querying the prompt page

(3) Verify that the user name already exists on the page

(4) The verification user name does not exist on the page

So far, Ajax has completed the function of verifying 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.