$.parseJSON()只支持标准的JSON,不标准的还是用eval("("+data+")")吧
什么 是标准的呢?
key和value都带引号的就是标准的; 而且必须是双引号,单引号也不行
string msg = ""; Model.Users currentUser; string jsonStr = ""; //JavaScriptSerializer js = new JavaScriptSerializer(); bool result = bll.UserLogin(loginID, loginPwd, out msg, out currentUser); if (!result) { jsonStr = "{\"result\":\"false\",\"msg\":\"" + msg + "\"}"; context.Response.Write(jsonStr); } else { //记录登陆成功的用户到Session中 context.Session.Add("currUser", currentUser); if (string.IsNullOrEmpty(redirectUrl)) { jsonStr = "{\"result\":\"true\",\"msg\":\"OK\",\"redirect\":\"\"}"; context.Response.Write(jsonStr); } else { jsonStr = "{\"result\":\"true\",\"msg\":\"OK\",\"redirect':\"" + context.Server.UrlDecode(redirectUrl) + "\"}"; context.Response.Write(jsonStr); } }