asp.net use jquery ajax to implement user registration detection (verify user name is saved) _jquery

Source: Internet
Author: User
It uses the jquery plugin to verify the username Oh, here is the use of jquery Ajax to verify the existence of the user name Oh. Everyone look at the effect map, the following will be attached to the source download.

The jquery framework implements AJAX to verify that the user name exists in some JS
Copy Code code as follows:

$ ("#accounts"). Formvalidator ({onshow: "Please enter user name", onfocus: "User name is at least 4 characters, up to 10 characters", Oncorrect: "The user name can be registered"}). Inputvalidator ({min:4,max:10,onerror: "User name at least 4 characters, up to 10 characters"}). Regexvalidator ({regexp: "username", datatype: "Enum", OnError: "username format is not correct"})
. Ajaxvalidator ({
Type: "Get",
URL: "/ws/nameexist.aspx",
DataType: "JSON",
Success:function (data) {
if (data = = "1")
{
return true;
}
Else
{
return false;
}
},
Buttons: $ ("#submit"),
Error:function () {alert ("The server does not return data, the server may be busy, please try again");
OnError: "This username is not available, please change user name",
Onwait: "The user name is being validated for legality, please wait ..."
})

Nameexist.aspx implementation of the source code
Copy Code code as follows:

protected void Page_Load (object sender, EventArgs e)
{
String accounts = request["Accounts"];
Loginnameexist (accounts);
}
public void Loginnameexist (string accounts)
{
Iusers user = AgileEIS.Web.DAL.Interface.DALHelper.DALManager.CreateUsers ();
User. session = Contexthelper.session;
User. Accounts = Accounts;
User. Refresh ();
if (!user. Exists)
{
Response.Write ("1");
}
Else
{
Response.Write ("0");
}
Response.End ();
Return
}

Asynchronous refresh implementation of a variety of ways, but also the use of a variety of JS framework, the above is implemented using the jquery framework Ajax to verify the existence of the user name. The first time such technical documents, it is inevitable that there is not enough, but also please see cool ...

Below will provide download
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.