Home  >  Article  >  Web Front-end  >  Implementation code of Ajax based on jQuery to verify whether user name exists_jquery

Implementation code of Ajax based on jQuery to verify whether user name exists_jquery

WBOY
WBOYOriginal
2016-05-16 18:08:37914browse

Example:
1. Request page AJax.aspx
HTML code

Copy code The code is as follows:



div>
div>

JS code
Copy code The code is as follows:




2, page AjaxUserInfoModify.aspx
Backend code
Copy code The code is as follows:

protected void Page_Load(object sender, EventArgs e)
{
string userName = Request.QueryString["userName"].ToString ();
if (userName == "James Hao")
{
Response.Write ("Username already exists! ");
}
else
{
Response.Write ("You can use this username!");
}
}

3 , run interface

(1)Initialization interface

(2) Querying prompt page

(3) Verify that the username already exists on the page

(4) Verify that the username does not exist on the page

At this point, the AJAX function to verify whether the user name exists has been completed.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn