前台代码:
function GetServersideData()
{
$.getJSON("ASHXHandler.ashx?a="+Math.random(), function(json) { alert("ss"); });
}
ashx代码如下:
public class ASHXHandler : IHttpHandler
{
#region IHttpHandler 成员
public bool IsReusable
{
get { return true; }
}
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
string data = "{name:\"jeff\"}";
context.Response.Write(data);
}
#endregion
}
现在点击按钮时,执行 GetServersideData 函数,但是没有任何反应,回调不能执行,请高手指点一下。。
------解决方案--------------------------------------------------------
没用过不太知道.
------解决方案--------------------------------------------------------
- C# code
 
public void ProcessRequest(HttpContext context)  {  context.Response.ContentType = "text/plain";  string data = "{name:\"jeff\"}";  context.Response.Write(data);  }
------解决方案--------------------------------------------------------
我日,搞错了。还以为你问的什么了。
context.Response.ContentType = "text/plain";
  string data = "{name:\"jeff\"}";
  context.Response.Write(data);
你自己断点调试下,进来后看看Write的是什么。
------解决方案--------------------------------------------------------
- HTML code
 
string date = "{\"date:[{\"name\":\"jeff\"}]}";
------解决方案--------------------------------------------------------
应该是$.getJSON()对json数据有检查的 。
你换成$.post()过去就能拿到数据 .