<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="1.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>1-ajax</title>
    <script type="text/javascript">
function createhttp()
{
var xmlhttp="";
  try 
  {
     if(window.XMLHttpRequest)
     {
       xmlhttp=new XMLHttpRequest();
     }
     else
     {
       xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
     }
  }
  catch(e)
  { 
     xmlhttp=false;
  }
return xmlhttp;
}function go1()
{
var xmlhttp;   xmlhttp=createhttp();
   xmlhttp.open("get","2.aspx",true);
   xmlhttp.onreadystatechange=go2;
   xmlhttp.send(null);
   
   function go2()
   {
      if (xmlhttp.readyState==4 || xmlhttp.status==200)
     {
     document.getElementById("div1").innerHTML=xmlhttp.responseText;
     }
   }
}</script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <input type ="button" onclick="go1()" value ="go" />
    <div id ="div1"></div>
    </div>
    </form>
</body>
</html>