Resource interpreted as Document but transferred with MIME type application/json:
来源:互联网 发布:券妈妈优惠券淘宝 编辑:程序博客网 时间:2024/05/29 17:32
后台向前端返回一个jsonresult,前端代码:
$("#Form5").ajaxSubmit({ type: "Post", dataType:"json", //data: $('#Form2').serialize(), //url:"<%=basePath%>kh/importFile", async:true, success:function(result){ // result = $.parseJSON(result.replace(/<.*?>/ig,"")); console.log(result); //新增成功 if(result.state==1){ alert(result.message); $("#imp_btn").removeAttr("disabled"); reloadKhInfo(); //window.location.href='<%=basePath %>mobile/week/fotoThirdPage?zbid='+result.data; //window.event.returnValue=false;}else{//新增失败alert(result.message);//$("#imp_btn").removeAttr("disabled");reloadKhInfo();return false;} },error:function(result){ alert("插入失败"); reloadKhInfo(); } });
查看network,确实返回了json:
但是在控制台输出:
在stack overflow上查了下,原文地址如下:
https://stackoverflow.com/questions/5232753/resource-interpreted-as-script-but-transferred-with-mime-type-application-json
将数据类型写成jsonp后,再次尝试:
这次可以看到返回结果是个标签格式,尝试解析json:
result = $.parseJSON(result.replace(/<.*?>/ig,""));
这次可以了:
阅读全文
0 0
- 关于easyui Resource interpreted as Document but transferred with MIME type application/json
- Resource interpreted as Document but transferred with MIME type application/json ...
- ThinkPHP Resource interpreted as Document but transferred with MIME type application/json 导致js无效
- 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问题的处理
- add-apt-repository: command not found
- 保留地址段
- HDU 6035 Colorful Tree(虚树)
- hdu 6035 Colorful Tree(dfs)
- Android 同时安装debug release版, 并且显示不同名字
- Resource interpreted as Document but transferred with MIME type application/json:
- Android中Activity.this,getApplicationContext(),getBaseContext()和this详解
- 移动端web开发技巧
- 链表中倒数第k个结点
- AES128加密解密以及参数的处理
- codeforces—— 467B —— Fedor and New Game
- ionic中如何隐藏头部的返回按钮
- ThreadLocal工作原理
- maven添加oracle jdbc依赖