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