Xml 加载文档时发生跨域错误

Xml 加载文档时发生跨域错误,xml,jquery,cross-domain,Xml,Jquery,Cross Domain,我使用1.8.2 jQuery的ajax加载rss提要,rss提要是来自另一台服务器的xml文档,我无法控制所述服务器 $.ajax({ type: 'GET', url: 'http://example.com/feed', contentType: "application/xml", dataType: 'xml', success: function(data){ alert(data); } }); 调用函数后,我不断收

我使用1.8.2 jQuery的ajax加载rss提要,rss提要是来自另一台服务器的xml文档,我无法控制所述服务器

$.ajax({
    type: 'GET',
    url: 'http://example.com/feed',
    contentType: "application/xml",
    dataType: 'xml',
    success: function(data){
        alert(data);
    }
});

调用函数后,我不断收到跨域错误。我错过了什么?

你没有错过任何东西。由于同源策略,您无法访问跨域数据:

你的选择是:

a) 使用与网站位于同一域上的代理服务器为您发出请求。或者使用类似的方法:

b) 使为要获取的提要提供服务的服务器包含CORS头,这将使您能够从中获取数据: