Bootstrap

.ashx ajax 反射,$.ajax post 方式提交请求,返回结果,为什么ashx程序已经执行完成,返回到error呢...

$.ajax post 方式提交请求,返回结果,为什么ashx程序已经执行完成,返回到error呢

前端代码

function examine(t)

{

$.ajax({

type: 'post',

url: 'Ashx/Examine.ashx?id=' + t,

error: function (XMLHttpRequest, textStatus, errorThrown) {

alert(XMLHttpRequest.status + "----" + XMLHttpRequest.readyState + "----" + textStatus);

},

success: function (result) {

alert(result);

}

});

location.reload();

}

后台ashx

public void ProcessRequest(HttpContext context)

{

context.Response.ContentType = "text/plain";

if(context.Request.QueryString["id"]==null)

{

context.Response.Clear();

context.Response.Write("参数错误");

context.Response.End();

}

else

{

string id = context.Request.QueryString["id"];

if(SqlHelper.UserInfo.Examine(Convert.ToInt32(id)))

{

context.Response.Clear();

context.Response.Write("审核通过");

context.Response.End();

}

else

{

context.Response.Clear();

context.Response.Write("审核失败");

context.Response.End();

}

}

}

ashx代码已执行,就是会返回error

另外用firebug断点调试的时候有时候可以

61271bf1e1ce90087d9b6155d2c51f67.png白板的微信

浏览 717回答 9

;