Front-end
CopyCode The Code is as follows: <! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Title> No title page </title>
<Style type = "text/CSS">
. Show {display: block ;}
. Hide {display: none ;}
</Style>
<SCRIPT type = "text/JavaScript" src = "jquery/jquery-1.2.6.js"> </SCRIPT>
<SCRIPT type = "text/JavaScript">
// This method encapsulates the Ajax Method for convenient calling.
Function myajax (){
$. Ajax ({
Type: 'get ',
URL: 'ajax. aspx ',
Data: 'id = 1 name = tree ',
Datatype: 'html ',
Beforesend: beforecall,
Success: callback
});
}
// Method before calling
Function beforecall (){
$ ('# Wait'). addclass ("show"). append ('calling ...');
// Alert (''); // test whether to call
}
// Callback function
Function callback (data ){
$ ('# Response'). append (data );
Certificate ('{wait'}.css ("display", "NONE ");
}
// Onload () event
$ (Function (){
$ ('# Confirm'). Click (myajax );
})
</SCRIPT>
</Head>
<Body>
<Div id = "Confirm"> click </div>
<Div id = "response"> receive background data </div>
<Div id = "wait" class = "hide"> Hello </div>
</Body>
</Html>
BackgroundCopy codeThe Code is as follows: protected void page_load (Object sender, eventargs E)
{
Response. Write ("hello" + request ["name"]);
Response. End ();
}