0

我一直在尝试从如何使用 JavaScript 解析 RSS 提要中获取示例?在职的。我的 HTML/脚本如下。获取请求不起作用。我没有收到任何错误,只是没有发生任何事情。这是因为跨域问题吗?谁能发现这个问题?最终,我想从政府 RSS 源中提取国债价格,例如: http: //www.federalreserve.gov/feeds/Data/H15_H15_RIFSGFSW04_N.B.XML 我是否采取了正确的方法?

<!DOCTYPE html>
<html>
<head>

<script src="jquery-1.11.1.min.js"></script>
<link rel="stylesheet" type="text/css" href="style.css">
<script>
$(document).ready(function() {
alert('Jquery working fine');
    $.get('https://stackoverflow.com/feeds/question/10943544', function (data) {
    $(data).find("entry").each(function () { // or "item" or whatever suits your feed
        var el = $(this);

        console.log("------------------------");
        console.log("title      : " + el.find("title").text());
        console.log("author     : " + el.find("author").text());
        console.log("description: " + el.find("description").text());
});
});

});
</script>

</head>

<body>
</body>

4

0 回答 0