IE8 MIME type application/json not found

简介: 如果: public ContentResult GetPaper(string testId) {     return ControllProctector.Do1(() =>         {             var result = new UserPaperBll().

如果:

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);

Creative Commons License本文基于 Creative Commons Attribution 2.5 China Mainland License发布,欢迎转载,演绎或用于商业目的,但是必须保留本文的署名 http://www.cnblogs.com/luminji(包含链接)。如您有任何疑问或者授权方面的协商,请给我留言。
目录
相关文章
|
11月前
|
资源调度 JavaScript Windows
yarn install命令报错解决办法-warning package-lock.json found.
yarn install命令报错解决办法-warning package-lock.json found.
212 0
|
2天前
|
JSON Java 数据格式
java操作http请求针对不同提交方式(application/json和application/x-www-form-urlencoded)
java操作http请求针对不同提交方式(application/json和application/x-www-form-urlencoded)
7 1
|
2月前
|
JSON JavaScript 数据格式
html jquery from 表单提交 application/x-www-form-urlencoded 改成 json
html jquery from 表单提交 application/x-www-form-urlencoded 改成 json
31 0
|
4月前
|
JSON PHP 数据格式
蓝易云 - PHP用CURL发送Content-type为application/json的POST请求方法
在这段代码中,我们首先创建了一个包含我们要发送的数据的数组,并使用 `json_encode`函数将其转换为JSON格式。然后,我们初始化了一个cURL会话,并设置了一些选项,包括POST请求方法、要发送的数据、返回结果和HTTP头部信息。最后,我们执行了cURL请求并关闭了会话。
111 2
|
3月前
|
JSON 数据格式
前后端数据交互----application/json数据格式和请求数据样式{“xxxx“:“xxxx“}
前后端数据交互----application/json数据格式和请求数据样式{“xxxx“:“xxxx“}
|
4月前
|
Java
Found multiple occurrences of org.json.JSONObject on the class path:
Found multiple occurrences of org.json.JSONObject on the class path:
66 0
|
11月前
|
JSON 监控 数据格式
Grafana导入 json 文件的 dashboard 错误 Templating Failed to upgrade legacy queries Datasource xxx not found
Grafana导入 json 文件的 dashboard 错误 Templating Failed to upgrade legacy queries Datasource xxx not found
343 0
|
5月前
|
JavaScript
【Vue Error】Virtual script not found, may missing <script lang=“ts“> “allowJs“: true / jsconfig.json
【Vue Error】Virtual script not found, may missing <script lang=“ts“> “allowJs“: true / jsconfig.json
|
12月前
|
存储 数据可视化 定位技术
关于 SAP Fiori Tools Application Modeler Page Map 功能的 app.json
关于 SAP Fiori Tools Application Modeler Page Map 功能的 app.json
|
JSON 前端开发 Java
【Json与Ajax交互报错解决】No converter found for return value of type: class com.github.pagehelper.PageInfo
【Json与Ajax交互报错解决】No converter found for return value of type: class com.github.pagehelper.PageInfo
316 0
【Json与Ajax交互报错解决】No converter found for return value of type: class com.github.pagehelper.PageInfo