我尝试用jquery加载一个xml文件。这个xml在htaccess
的路径下Header set Access-Control-Allow-Origin *
Header set Access-Control-Allow-Credentials true
Header set Access-Control-Expose-Headers *
Header set Access-Control-Allow-Methods *
Header set Access-Control-Allow-Headers *
AuthType Basic
AuthName "Restricted area"
AuthUserFile /var/www/domains/subdomain.domain.com/.passwd
Require valid-user
如果我从子域请求文件,那没关系,但是如果我从domain.com请求相同的文件,我有这个错误。
XMLHttpRequest cannot load http://domain.com/path/file.xml?no=1381827329. Origin http://www.domain.com is not allowed by Access-Control-Allow-Origin.
如果我从htaccess中删除Basic Auth,我没有问题。
我想显示模态弹出窗口,但我收到error.status 0。
谢谢你!