开发者

XMLHttpRequest cannot load http://www.reddit.com/.xml

Does anyone know how to fix this error? I am using jquery 1.6.2

XMLHttpRequest cannot load http://www.reddit.com/.xml. Origin null is not allowed by Access-Control-Allow-Origin.

开发者_如何学C
$(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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜