Jquery + asp.net check whether the account has been registered with the instance code (1/2)

Source: Internet
Author: User

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

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.