Front desk
Copy Code code as follows:
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<title> Untitled Page </title>
<script type= "Text/javascript" src= "Jquery/jquery.js" ></script>
<script type= "Text/javascript" >
This method encapsulates the Ajax method for easy invocation.
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>
<body>
<div id= "Confirm" > Click </div>
<div id= "Response" > Receive background Data </div>
</body>
Backstage
Copy Code code 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
{
protected void Page_Load (object sender, EventArgs e)
{
Response.Write ("Hello");
Response.End ();
}
}