ThinkPHP Resource interpreted as Document but transferred with MIME type application/json 导致js无效
来源:互联网 发布:移动网络切换器 编辑:程序博客网 时间:2024/06/05 17:34
ThinkPHP中当使用
$this->ajaxReturn(array('file'=>$outputFileName));
返回数据时header标签会被强行改成Content-Type:application/json; charset=utf-8;即使在之前你设置header(‘Content-Type:text/html; charset=utf-8’);也不行。如果你的请求数据类型和返回数据类型不同就会出现错误:
Resource interpreted as Document but transferred with MIME type application/json
后续js无法执行。
解决办法:
可使用一下方法解决:
header('Content-Type:text/html; charset=utf-8');echo json_encode($data);
1 0
- ThinkPHP Resource interpreted as Document but transferred with MIME type application/json 导致js无效
- 关于easyui Resource interpreted as Document but transferred with MIME type application/json
- Resource interpreted as Document but transferred with MIME type application/json ...
- Resource interpreted as Document but transferred with MIME type application/json:
- 谷歌浏览器下在文本框中敲回车会下载。。。Resource interpreted as Document but transferred with MIME type application/json
- ajaxfileupload上传文件,返回json数据报错的问题。 Resource interpreted as Document but transferred with MIME type ap
- Resource interpreted as Stylesheet but transferred with MIME type application/x-css
- Resource interpreted as Font but transferred with MIME type application/x-font-woff
- SpringMVC Resource interpreted as Script but transferred with MIME type application/octet-stream:
- Resource interpreted as Stylesheet but transferred with MIME type application/octet-stream
- 关于chrome Resource interpreted as Script but transferred with MIME type text/html的问题
- 关于chrome Resource interpreted as Script but transferred with MIME type text/html的问题
- golange 错误如下 Resource interpreted as Script but transferred with MIME type text
- Resource interpreted as Stylesheet but transferred with MIME type text/html:以及Uncaught SyntaxError:
- Resource interpreted as Image but transferred with MIME type text/plain 警告解决方案
- Chrome 报 Resource interpreted as Script but transferred with MIME type text/plain 警告的解决办法
- Resource interpreted as Script but transferred with MIME type text/html
- 关于 Resource interpreted as Script but transferred with MIME type text/plain问题的处理
- C——结构体
- javascript表格单元格的添加删除修改并对其进行移动以及拷贝
- BPI-R1 刷入自己编译的openwrt后局域网间无法ping通
- C——union、enum、file
- 从零开始学习Linux部署Java web项目
- ThinkPHP Resource interpreted as Document but transferred with MIME type application/json 导致js无效
- android中颜色对照表
- 针对文件描述符和合针对流的两种函数对文件的复制
- HTML5+CSS3+JS学习笔记-3
- JavaScript sort() 方法
- iOS直播APP—原理篇
- 会话追踪中的Cookie和Session机制的区别
- eclipse安装配置使用笔记
- 【摘抄】设置你的进度条