ionic $resource.query 访问,Access-Control-Allow-Origin问题
2016-04-07 21:11
357 查看
问题描述:
ionic.bundle.js:23826GET “xxxxx” 1XMLHttpRequest cannot load
“xxxxx”. No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘http://localhost:63342’ is therefore not allowed access. The response had HTTP status code 403.
1、我使用的ionic 中的$resource.query访问服务器的,添加上
header: {‘Access-Control-Allow-Origin’: “*”}
就可以了,代码如下:
2、在浏览器的快捷方式上的目标上添加 –disable-web-security,注意添加的前一定要空一格。如下图:
ionic.bundle.js:23826GET “xxxxx” 1XMLHttpRequest cannot load
“xxxxx”. No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘http://localhost:63342’ is therefore not allowed access. The response had HTTP status code 403.
1、我使用的ionic 中的$resource.query访问服务器的,添加上
header: {‘Access-Control-Allow-Origin’: “*”}
就可以了,代码如下:
var resouce=$resource( apiUrl,{}, { query: { method: 'get', header: {'Access-Control-Allow-Origin': "*"} params: { a:'getList', id:'@id', page:'@page' }, timeout: 20000 } });
2、在浏览器的快捷方式上的目标上添加 –disable-web-security,注意添加的前一定要空一格。如下图:
相关文章推荐
- IIS访问ASP页面时报错The requested resource is in use.的解决办法
- AJAX 请求区分 $_SERVER['HTTP_X_REQUESTED_WITH'] 小解
- mysql query browser中文乱码的解决方法
- 对于mysql的query_cache认识的误区
- 关于query Javascript CSS Selector engine
- Android之使用Android-query框架开发实战(一)
- Android之使用Android-query框架开发实战(二)
- 如何解决PHP使用mysql_query查询超大结果集超内存问题
- android开发教程之framework增加字符串资源和图片等resource资源
- nginx connect() to unix:/var/run/php-fpm.sock failed (11: Resource temporarily unavailable)
- Pg结果集缓存工具--pqc
- SCRIPT1028:缺少标识符、字符串或数字 jquery ajax
- PHP使用http_build_query()构造URL字符串的方法
- 如何解决PHP使用mysql_query查询超大结果集超内存问题
- 迁移是10g-11g ogg正好有用武之地N种方法
- nagios错误汇总以备工作所需
- Mysql的查询缓存区的优化
- 数据库之关系型AR
- jQuery获取自动截取过长的文本内容,显示成省略号形式。
- Font from origin 'http://apps.bdimg.com' has been blocked