有谁知道如何解决这个错误?我正在使用jquery 1.6.2XMLHttpRequest无法加载http://www.reddit.com/.xml
XMLHttpRequest无法加载http://www.reddit.com/.xml。来源null为 Access-Control-Allow-Origin不允许。
$(document).ready(function() {
$.ajax({
type: "GET",
url: "http://www.reddit.com/.xml",
dataType: "xml",
crossDomain: true,
success: xmlParser
});
// ...
});
简而言之,'crossDomain'不能用xml开箱即用,但它_does_可以与JSONP一起工作。使它与XML协同工作需要一些额外的工作。 –
[需要帮助使用JavaScript获取跨域XML]的可能重复(http://stackoverflow.com/questions/1550839/need-help-with-getting-cross-domain-xml-with-javascript) – Quentin
嗨,我同意雷,请参阅以下网页以获取更详细的信息:http://www.nczonline.net/blog/2010/05/25/cross-domain-ajax-with-cross-origin-resource-sharing/关注 – Neil