俩天了!!!!!!

万玩完顽完 万玩完顽完 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
var s = "";
$(function () {
$("#open").click(function () {
$.ajax({
type: "post",
url: "../Master/Ma.ashx",
data: { 'UserID': "admin" },
dataType: "json",
error: function () {
window.location.href = "/Web/Error.aspx";
},
success: function (json) {
alert(json);
}
})


})
});
这个是前台js




public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
string str = "";
DataSet ds = new DataSet();
string UserID = context.Request["UserID"].ToString();
ds = DBhelper.ProcQueryData("Sp_GetNavigation", new IDataParameter[] { new SqlParameter("@UserID", UserID) });
if (ds.Tables[0].Rows.Count > 0)
{
//将对象序列化为stringjson
str = DataSetToJson(ds).ToString();

}

context.Response.Write(str);
}



上面的是后台 。ashx

str



json的内容弹不出来!!!怎么回事啊?如果要访问json中的数据该如何写循环遍历?
苍天···
...全文
评论 5
收藏 已收藏
分享
返回顶部
万玩完顽完
Ajax 52,778 成员 25,334 内容