一共2个页面:
Default.aspx 以及其CS文件,CS文件无新增方法
Default2.aspx 以及其CS文件
Default.aspx
< %@ Page Language ="C#" AutoEventWireup ="true" CodeFile ="Default.aspx.cs" Inherits ="_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.w3.org/1999/xhtml" >
< head runat ="server" >
         < title >Ajax </title>
         < script type ="text/javascript" >
                var xmlhttp;
                function createXMLHttpRequest() {
                        if (window.ActiveXObject) {
                                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
                        }
                        else if (window.XMLHttpRequest) {
                        xmlhttp = new XMLHttpRequest();
                        }
                        
                }
                function startRequest() {
                        createXMLHttpRequest();
                        var inputText = document.getElementById("txtId");
                        xmlhttp.onreadystatechange = handleStateChange;
                        xmlhttp.open("GET", "Default2.aspx?yourparm=" + inputText.value, true);
                        xmlhttp.send(null);

                }

                function handleStateChange() {
                        if (xmlhttp.readyState==4) {
                                if (xmlhttp.status == 200 || xmlhttp.status == 0) {
                                        alert(xmlhttp.responseText);
                                 }
                        }
                 }
         </script>
</head>
< body >
         < form id ="form1" runat ="server" >
         < div >
                 < input type ="text" id ="txtId" value ="11" onblur ="startRequest();" />
         </div>
         </form>
</body>
</html>
Default2.aspx
< %@ Page Language ="C#" AutoEventWireup ="true" CodeFile ="Default2.aspx.cs" Inherits ="Default2" % >

Default2.aspx.cs

using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Default2 : System.Web.UI.Page
{
void Page_Load() void Page_Load(object sender, EventArgs e)
                {
                                 string request = Request.QueryString[ "yourparm"].ToString();

                                Response.Write( "你输入的东西是" + request + "经过ajax调用的");
                }
}