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>
<SCRIPT type = "text/JavaScript" src = "jquery/jquery. js"> </SCRIPT>
<SCRIPT type = "text/JavaScript">
// This method encapsulates the Ajax Method for convenient calling.
Function myajax (){
$. Ajax ({
Type: 'get ',
URL: 'ajax. aspx ',
Data :'',
Datatype: 'html ',
Success: callback
});
}
// Callback function
Function callback (data ){
$ ('# Response'). append (data );
}
// Onload () event
$ (Function (){
$ ('# Confirm'). Click (myajax );
})
</SCRIPT>
</Head>
<Body>
<Div id = "Confirm"> click </div>
<Div id = "response"> receive background data </div>
</Body>
</Html>
background copy Code the code is as follows: using system;
using system. data;
using system. configuration;
using system. collections;
using system. web;
using system. web. security;
using system. web. ui;
using system. web. UI. webcontrols;
using system. web. UI. webcontrols. webparts;
using system. web. UI. htmlcontrols;
Public partial class Ajax: system. web. UI. page
{< br> protected void page_load (Object sender, eventargs e)
{< br> response. write ("hello");
response. end ();
}< BR >}