Asp.net 2.0 jQuery取数据失败
kong佳 2012-11-13 08:57:01 服务器端:
using System;
using System.Collections;
using System.Web;
namespace SiteServer.CMS.BackgroundPages.UserAjax
{
public class UserAjax : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
var data = new Hashtable();
if (!StringUtils.IsNullorEmpty(UserFactory.Instance.CurrentUserName))
{
IUserInfo userInfo = UserFactory.Instance.GetUserInfo(UserFactory.Instance.CurrentUserName);
//data["userName"] = UserFactory.Instance.CurrentUserName;
//data["email"] = userInfo.Email;
//data["company"] = userInfo.Mobile;
data.Add("userName",userInfo.UserName);
data.Add("email",userInfo.Email);
}
//var jss = new JavaScriptSerializer();
//var json = jss.Serialize(data);
context.Response.ContentType = "text/javascript";
context.Response.Write(data);
}
public bool IsReusable
{
get { return false; }
}
}
}
using System;
using System.Collections;
using System.Web;
//using System.Web.Script.Serialization;
using BaiRong.Core;
using UserCenter.Core;
using UserCenter.Model;
namespace SiteServer.CMS.BackgroundPages.UserAjax
{
public class UserAjax : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
var data = new Hashtable();
if (!StringUtils.IsNullorEmpty(UserFactory.Instance.CurrentUserName))
{
IUserInfo userInfo = UserFactory.Instance.GetUserInfo(UserFactory.Instance.CurrentUserName);
//data["userName"] = UserFactory.Instance.CurrentUserName;
//data["email"] = userInfo.Email;
//data["company"] = userInfo.Mobile;
data.Add("userName",userInfo.UserName);
data.Add("email",userInfo.Email);
}
//var jss = new JavaScriptSerializer();
//var json = jss.Serialize(data);
context.Response.ContentType = "text/javascript";
context.Response.Write(data);
}
public bool IsReusable
{
get { return false; }
}
}
}
但总是无法提取数据,请问是什么原因