我想解析托管在另一个域上的 XML 文档,这是可能的还是违反了跨域策略。我知道你可以$.getScript()
从其他域,XML 也一样吗?我的尝试使用$.ajax()
失败了。
user967451
问问题
79 次
2 回答
0
The other domain will need to set the Access-Control-Allow-Origin
header with url of the domain you are connecting from (e.g. http://example.com
), or *
to support any domain.
You can do this via a .htaccess file on Apache if you have the mod_headers module installed by adding a line like this:
Header set Access-Control-Allow-Origin "http://example.com"
Alternatively, if you're serving up the XML via php, you could add the header with the php header
function.
header('Access-Control-Allow-Origin: http://example.com');
于 2013-06-27T16:15:39.383 回答
0
克服跨域策略的最佳方法是使用JSONP
.
于 2013-06-27T15:50:22.343 回答