52,797
社区成员
发帖
与我相关
我的任务
分享
function test1()
{
var uname;
var upwd;
uname = document.frames("iframe2").document.getElementById("email").value;
upwd = document.frames("iframe2").document.getElementById("password").value;
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{
try
{
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
}
}
}
var url = "http://localhost/login_ajax.aspx?name="+uname;
alert(url);
xmlHttp.open("GET",url, true);
xmlHttp.onreadystatechange=updatePage;
xmlHttp.send(null)
function updatePage()
{
if(4==xmlHttp.readyState)
{
alert(xmlHttp.status);
if(200==xmlHttp.status)
{
alert(xmlHttp.responseText);
if (xmlHttp.responseText=="yes")
{
alert("1");
}
else
{
alert("2");
}
}
else
{
alert("3");
}
}
}
}
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="login_ajax.aspx.cs" Inherits="login_ajax" %>
<%Response.Write(returnvalue);%>
public partial class login_ajax : System.Web.UI.Page
{
public string returnvalue = "";
protected void Page_Load(object sender, EventArgs e)
{
returnvalue = "yes";
}
}
alert(xmlHttp.status);
if(200==xmlHttp.status)
{
alert(xmlHttp.responseText);
if (xmlHttp.responseText=="yes")
{
alert("1");
}
else
{
alert("2");
}
}
else
{
alert(xmlHttp。responseText);////////输出错误看看。。。。。
}
}