求救Ajax取ashx值的问题。
html里
$.ajax({ type: 'post', cache: false, dataType: 'json', url: 'WebHandler/User.ashx', data: [ { name: 'Action', value: 'name' } ], success: function (result) { if (result !== "") { alert(result);//result的结果永远是[object] } }, error: function () { }, beforeSend: function () { }, complete: function () { } }); public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string terms = context.Request.Params["Action"]; switch (terms)//得到传的值为 name { case "id": context.Response.Write(yjCookie.GetUce.Id); break; case "name": context.Response.Write(yjCookie.GetUce.Name);//调试发现传的值为“测试用户” break; default: context.Response.Write(""); break; } context.Response.End(); }