XMLHttp。。。。
<%@ 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>无标题页</title>
<script type ="text/javascript" >
var xmlhttp;
function startreqest()
{
createxmlhttp();
xmlhttp.onreadystatechange=change;
xmlhttp.open("GET","response.aspx",true);
xmlhttp.send(null);
}
function createxmlhttp()
{
if (window.ActiveXObject)
{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
else if(window.XMLHttpRequest){
xmlhttp=new XMLHttpRequest();
}
}
function change()
{
if (xmlhttp.readyState==4)
{
alert(xmlhttp.status);
if(xmlhttp.status==200)
{
alert(xmlhttp.responseText);
}
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<input type ="button" value ="单击我试试" onclick ="startreqest();"/>
</div>
</form>
</body>
</html>
response.cs
Response.Write("I am a Ajax");
我这样写是返回的404是什么原因啊。。。。。
书上也是这样的。。。是什么原因呢,帮帮忙老大们...