简体   繁体   English

做jquery ajax时Access-Control-Allow-Origin不允许使用Origin null

[英]Origin null is not allowed by Access-Control-Allow-Origin while doing jquery ajax Get

I'm trying to use jquery ajax to download xml from here: http://www.maciejko-sklep.pl/components/com_esklep/integracja.php?type=cenuj&pass=JH64HU7 我正在尝试使用jquery ajax从此处下载xml: http : //www.maciejko-sklep.pl/components/com_esklep/integracja.php? type=cenuj&pass=JH64HU7

or either html: link: http://www.maciejko-sklep.pl/components/com_esklep/integracja.php?type=html&pass=4FMIHGfd 或html:链接: http : //www.maciejko-sklep.pl/components/com_esklep/integracja.php? type=html&pass= 4FMIHGfd

and I get this error Origin null is not allowed by Access-Control-Allow-Origin. 我收到此错误,Access-Control-Allow-Origin不允许使用Origin null。

I'm trying to figure this out, anyone knows how to fix this and somehow download content from either of those links. 我正在尝试弄清楚这一点,任何人都知道如何解决此问题以及以某种方式从这些链接中的任何一个下载内容。 Ps when i paste the link in url it works fine, but i cannot send ajax requests. Ps,当我将链接粘贴到url时,效果很好,但是我无法发送Ajax请求。 THX 谢谢

除非服务器明确启用了cors ,否则跨域ajax请求受浏览器的限制。

Add this to the top of your php file: 将此添加到您的php文件的顶部:

<?php header('Access-Control-Allow-Origin: *'); ?>

It solved my issue with access-control-allow-origin 它通过access-control-allow-origin解决了我的问题

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Access-Control-Allow-Origin不允许使用$ http.get,但$ .ajax是 - $http.get is not allowed by Access-Control-Allow-Origin but $.ajax is 无法与jsonp配合使用的Access-Control-Allow-Origin不允许使用Origin null - Origin null is not allowed by Access-Control-Allow-Origin not working with jsonp Ajax-&#39;Origin localhost不允许Access-Control-Allow-Origin&#39; - Ajax - 'Origin localhost is not allowed by Access-Control-Allow-Origin' Access-Control-Allow-Origin不允许源,jQuery Mobile - Origin is not allowed by Access-Control-Allow-Origin , jquery mobile Access-Control-Allow-Origin 不允许 Origin - Origin is not allowed by Access-Control-Allow-Origin Access-Control-Allow-Origin不允许起源 - Origin is not allowed by Access-Control-Allow-Origin XMLHttpRequest无法加载http:// localhost:8089 / jquery。 Access-Control-Allow-Origin不允许使用原点null - XMLHttpRequest cannot load http://localhost:8089/jquery. Origin null is not allowed by Access-Control-Allow-Origin jQuery使用WCF。 错误:XMLHttpRequest无法加载Access-Control-Allow-Origin不允许使用Origin null - Jquery to consume WCF. error: XMLHttpRequest cannot load Origin null is not allowed by Access-Control-Allow-Origin Access-Control-Allow-Origin不允许使用Origin null(从android获取XML) - Origin null is not allowed by Access-Control-Allow-Origin (get XML from android) 起源<origin>不允许访问控制允许来源</origin> - Origin <origin> is not allowed by Access-Control-Allow-Origin
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM