如何允许CORS/Access-Control-Allow-Origin [英] how to allow CORS /Access-Control-Allow-Origin
本文介绍了如何允许CORS/Access-Control-Allow-Origin的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
很抱歉这个愚蠢的问题,但是如何允许"Access-Control-Allow-Origin?"
sorry for the stupid question, but how to I allow "Access-Control-Allow-Origin?"
我希望页面A(我从中获取内容的页面)允许页面B(我需要将内容放入其中的页面)访问.奇怪的是它们都在同一台服务器上,一个是wordpress页面,另一个是静态的.
I want page A (the page I am getting content from) to allow page B(where I need content pulled into) access. It's weird they are both on the same server one is a wordpress page and one is static.. not sure where the code is supposed to go to make this happen.
推荐答案
我建议将url选项修改为相对路径,以避免出现此问题.
I'd suggest modifying the url option to a relative path to avoid this issue.
$.ajax(function(){
url: /*"http://www.mydomain.com*/"/foo.html",
....
});
这篇关于如何允许CORS/Access-Control-Allow-Origin的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文