admin管理员组文章数量:1388080
When Page loads in my console it shows this error
Font from origin '' has been blocked from loading by Cross-Origin Resource Sharing policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '' is therefore not allowed access.
and when i call ajax function. it show this error
XMLHttpRequest cannot load .php/home/getCity?city=d. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '' is therefore not allowed access.
Which ajax functions are in home controller. But i'm in another controller. may be I think it was problem. how can i solve this ?
When Page loads in my console it shows this error
Font from origin 'http://example.' has been blocked from loading by Cross-Origin Resource Sharing policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://www.example.' is therefore not allowed access.
and when i call ajax function. it show this error
XMLHttpRequest cannot load http://example./index.php/home/getCity?city=d. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://www.example.' is therefore not allowed access.
Which ajax functions are in home controller. But i'm in another controller. may be I think it was problem. how can i solve this ?
Share Improve this question asked Nov 12, 2015 at 7:06 Siddhartha esunuriSiddhartha esunuri 1,1441 gold badge17 silver badges29 bronze badges 1- 1 See this : html5rocks./en/tutorials/cors – ZenithS Commented Nov 12, 2015 at 7:09
2 Answers
Reset to default 4For Cross-Origin Resource in Codeignitor you have to include this line in controller right after start of <?php
tag
header('Access-Control-Allow-Origin: *');
<?php
header('Access-Control-Allow-Origin: *');
class Myclass extends CI_Controller {
}
This works perfectly fine in codeigniter
本文标签: javascriptNo 39AccessControlAllowOrigin39 error in HMVC CodeigniterStack Overflow
版权声明:本文标题:javascript - No 'Access-Control-Allow-Origin' error in HMVC Codeigniter - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744485814a2608441.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论