Does anyone know how to fix this error? I am using jquery 1.6.2
开发者_如何学CXMLHttpRequest cannot load http://www.reddit.com/.xml. Origin null is not allowed by Access-Control-Allow-Origin.
$(document).ready(function () {
$.ajax({
type: "GET",
url: "http://www.reddit.com/.xml",
dataType: "xml",
crossDomain: true,
success: xmlParser
});
// ...
});
Use zrssfeed it'll make your life a lot easier, jsFiddle.
$('#test').rssfeed('http://www.reddit.com/.xml');
its because same-origin-policy
create a server side proxy and have that proxy query the webservice and return your ajax request the xml response
精彩评论