急求,ajax 错误500 。在线等,马上给分~~

Tracy_fu 2011-08-23 04:34:45
JS代码;

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");
}
}
}

}



login_ajax.aspx的JS 代码:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="login_ajax.aspx.cs" Inherits="login_ajax" %>
<%Response.Write(returnvalue);%>

login_ajax.aspx.cs


public partial class login_ajax : System.Web.UI.Page
{
public string returnvalue = "";
protected void Page_Load(object sender, EventArgs e)
{
returnvalue = "yes";

}
}


报500的错。请教是怎么回事呀。代码有什么问题吧?急,马上给分~~~
...全文
4889 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
ETCentury 2012-05-07
  • 打赏
  • 举报
回复
500,是后台程序错误。

public partial class login_ajax : System.Web.UI.Page
{
public string returnvalue = "";
protected void Page_Load(object sender, EventArgs e)
{
returnvalue = "yes";

}
}
把 return value 分开。
  • 打赏
  • 举报
回复
500是服务器未知错误,看下端口,看下路径什么的
licip 2012-05-05
  • 打赏
  • 举报
回复
如果是500那不是你前台的错,是后台的错。
可儿 2012-05-05
  • 打赏
  • 举报
回复
你输出错误看,自己一步调
sxmonsy 2011-09-22
  • 打赏
  • 举报
回复
我以为是给500分呢。。。额 好吧 原来是500错误。是没找到你的请求资源吧,仔细看看你的资源地址,直接在浏览器里输入资源地址看下。
ahlaliuchao 2011-09-21
  • 打赏
  • 举报
回复
上次我也有500这个错误。。
当时我的原因也是内部错误,是请求服务器时候,服务器那个html地址我写错了
zh19891225 2011-09-21
  • 打赏
  • 举报
回复
如果服务器错误500,最好是看看你IIS 的配置...
搜索下一 IIS 500 的错误 ..
QQ164681187 2011-09-18
  • 打赏
  • 举报
回复
貌似没什么破绽 post提交试试看
lufeng589674 2011-09-17
  • 打赏
  • 举报
回复
500错误,是服务器内部错误。看完代码,没发现错误。
我刚才做了测试,可以运行。
弹出信息是:200 yes 1
var url = "login_ajax.aspx?name="+uname;
我是直接这样使用的。
liujie1575720297 2011-09-15
  • 打赏
  • 举报
回复
服务器错误
blackgull 2011-09-12
  • 打赏
  • 举报
回复
错误500好象是找不到资源,你看看你的url是不是有问题。
你试试 直接在浏览器中输入http://localhost/login_ajax.aspx?name=abc之类的,看看网页显示么。
如果不显示,就是你的 iis 配置有问题了。
Go 旅城通票 2011-08-23
  • 打赏
  • 举报
回复

alert(xmlHttp.status);
if(200==xmlHttp.status)
{
alert(xmlHttp.responseText);
if (xmlHttp.responseText=="yes")
{
alert("1");
}
else
{
alert("2");
}
}
else
{
alert(xmlHttp。responseText);////////输出错误看看。。。。。
}
}
拐点 2011-08-23
  • 打赏
  • 举报
回复
public partial class login_ajax : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Response.Write("yes");
}
}

52,797

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 Ajax
社区管理员
  • Ajax
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧