IE8 MIME type application/json not found

如果:

public ContentResult GetPaper(string testId)
{
    return ControllProctector.Do1(() =>
        {
            var result = new UserPaperBll().GetTestPaper(testId, NativeHelper.LoginUser2.Id, NativeHelper.LoginUser2.OrganizationId);
            return new ContentResult
            {
                Content = new JavaScriptSerializer { MaxJsonLength = int.MaxValue }.Serialize(result),
                ContentType = "application/json"
            };
        });
}

我们会得到一些不正确的空值。需要去掉 ContentType = "application/json" 该行,然后前台将字符串转为 JSON 对象即可。

success: function (data) {
    data = JSON.parse(data);

posted @ 2014-03-20 17:00  陆敏技  阅读(2211)  评论(0编辑  收藏  举报
Web Counter
Coupon for Contacts