Call Jquery's method $. Ajax (function) to implement Ajax and pass the account information to the Web Service. The Web service then calls the database operation class to query the database and returns the data to the front-end page.
Jquery + asp tutorial. net Check whether the account has been registered instance code
<% @ Page language = "c #" autoeventwireup = "true" codebehind = "default. aspx. cs" inherits = "ajax_xml. _ default" %>
<! Doctype html public "-// w3c // dtd xhtml 1.0 transitional // en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<Html xmlns = "http://www.bKjia. c0m/1999/xhtml">
<Head runat = "server">
<Title> </title>
<Script type = "text/Webpage effects" src = "jquery-1.3.2-vsdoc2. webpage effects" language = "webpage effects"> </script>
<Script type = "text/javascript" language = "javascript">
$ (Function (){
$ ("# <% = Userid. clientid %>"). keyup (
Function (){
$. Ajax ({
Type: "post ",
Contenttype: "application/Webpage effects on ",
Datatype: "json ",
Url: "webservice1.asmx/userisexist ",
Data: "{userid: '" + $ ("# <% = userid. clientid %>"). val () + "'}",
Success: function (result ){
If (result. d = "true ")
$ ("# <% = Isexist. clientid %>"). text ("yes"); // The account already exists.
Else
$ ("# <% = Isexist. clientid %>"). text ("no ");
}
});
}
);
})
</Script>
</Head>
<Body>
<Form id = "form1" runat = "server">
<Div>
<Table style = "width: 100%;">
<Tr>
<Td>
</Td>
<Td>
</Td>
<Td>
</Td>
</Tr>
<Tr>
<Td>
</Td>
<Td>
<Asp: textbox id = "userid" runat = "server"> </asp: textbox>
<Asp: label id = "isexist" runat = "server" visible = "true"> </asp: label>
</Td>
<Td>
</Td>
</Tr>
<Tr>
<Td>
</Td>
<Td>
</Td>
<Td>
</Td>
</Tr>
</Table>
</Div>
</Form>
</Body>
</Html>
1 2