(转)解决“No 'Access-Control-Allow-Origin' header is present on the requested resource”
来源:互联网 发布:中航微电子重庆 知乎 编辑:程序博客网 时间:2024/06/14 05:15
原地址:http://blog.csdn.net/cryhelyxx/article/details/43761887
1. 问题描述
在js中使用ajax请求在网页控制台下打印以下错误信息:
XMLHttpRequest cannot load http://192.168.2.46:8000/account/getjson/. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:63342' is therefore not allowed access.
本人的ajax代码如下
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
2. 解决方法
将上面的dataType: 'JSON'
替换为dataType: 'JSONP'
即可。
OK, Enjoy it!!!
阅读全文
0 0
- (转)解决“No 'Access-Control-Allow-Origin' header is present on the requested resource”
- No 'Access-Control-Allow-Origin' header is present on the requested resource. 报错解决。
- 解决“No 'Access-Control-Allow-Origin' header is present on the requested resource”
- 解决“No 'Access-Control-Allow-Origin' header is present on the requested resource.”
- 解决Vue请求 ‘No 'Access-Control-Allow-Origin' header is present on the requested resource’错误
- No 'Access-Control-Allow-Origin' header is present on the requested resource.一种解决思路
- No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin is therefore no
- No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '***' is theref
- No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '
- No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin
- No 'Access-Control-Allow-Origin' header is present on the requested resource 的解决方法
- “No 'Access-Control-Allow-Origin' header is present on the requested resource”
- 报No 'Access-Control-Allow-Origin' header is present on the requested resource
- 跨域问题:No 'Access-Control-Allow-Origin' header is present on the requested resource.
- jquery ajax No 'Access-Control-Allow-Origin' header is present on the requested resource
- No 'Access-Control-Allow-Origin' header is present on the requested resource
- No 'Access-Control-Allow-Origin' header is present on the requested resource.
- No 'Access-Control-Allow-Origin' header is present on the requested resource
- mongo $addToSet获取唯一值实例
- JavaScript 中的 this 机制
- Aspose.Cells 11月新版V17.11发布 | 附下载
- ThreadPoolExecutor机制
- linux ubuntu操作系统修改网卡名称为ethx的方法
- (转)解决“No 'Access-Control-Allow-Origin' header is present on the requested resource”
- MacOS 向NTFS文件系统中放文件
- 浅谈String、StringBuffer和StringBuilder
- 使用python3调用谷歌翻译成中文
- tensorflow 神经网络解决二分类问题
- Opus一款开源、免费、自由度高的有损音频编解码器
- sftp用法
- Java:构造器,构造代码块,静态代码块的执行顺序。
- 阿里云新建云服务器ECS