<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="GetData.aspx.cs" Inherits="GetData" %>

<!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" >

<script type="text/javascript" language="javascript">
var XmlHttp = false;

GetXmlHttpRequest();
if (XmlHttp)
{  
  XmlHttp.open("GET", "MyData.txt", true);
  XmlHttp.onreadystatechange = Callback;
  XmlHttp.send(null);
}

function Callback()
{
  if (XmlHttp.readyState == 4)
  {
    if (XmlHttp.status == 200 )
    {
       alert(XmlHttp.responseText);     
    }
    else
    {
       alert("Requested resource not found");
    }
  }
}

function GetXmlHttpRequest()
{
  try
  {       
     XmlHttp = new ActiveXObject("Msxml2.XMLHTTP");    
  }
  catch (e)
  {
      alert("Failed to get XmlHttpRequest");
      XmlHttp = false;
  }
}
</script>

<head runat="server">
    <title>GetData using XmlHttpRequest</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
    </div>
    </form>
</body>
</html>
