<Html xmlns = "http://www.w3.org/1999/xhtml">
<Head runat = "server">
<Title> </title>
<Script type = "text/javascript">
Function check_email (){
Var email = $ ("# email"). attr ("value ");
$. Post ("han. ashx ",
{Email: email },
Function (data ){
Window. alert (data );
});
}
$ (Document). ready (function (){
$ ("# Queren"). click (function () {check_email ();});
})
</Script>
</Head>
<Body>
<Input type = "text" id = "email"/>
<Input id = "queren" type = "button" value = "test"/>
</Body>
</Html>
Han. ashx code
Public void ProcessRequest (HttpContext context)
{
Context. Response. ContentType = "text/plain ";
Context. Response. Write (context. Request ["Email"]);
}
Public bool IsReusable
{
Get
{
Return false;
}
}
1. $ ("# email"). attr ("value") gets the value of the email text box.
2. To implement jquery ajax, you must add
<System. web>
<Compilation debug = "true" targetFramework = "4.0"/>
<HttpHandlers>
<Add verb = "*" path = "*. ashx" type = "System. Web. UI. SimpleHandlerFactory" validate = "false"/>
</HttpHandlers>
</System. web>
3,
Author's "Technical Study Notes"