我正尝试使用Google Feed API加载Feed,但我无法获取最新记录。下面我曾尝试:Google Feed API JSON输出不显示最新记录
<script src="//code.jquery.com/jquery-1.11.2.min.js"></script>
<script type="text/javascript">
$(function() {
url = 'http://www.propertyguru.com.sg/news-rss/SG-PM';
var randomNum = Math.floor((Math.random() * 10000) + 1);
$.ajax({
type: "GET",
url: document.location.protocol + '//ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=20&callback=?&q=' + encodeURIComponent(url) + '&nocache=' + (new Date).getTime() + randomNum,
dataType: 'json',
historical: false,
error: function() {
alert("Unable to load feed, Incorrect path or invalid feed");
},
success: function (data) {
alert(JSON.stringify(data, null, "\t"));
}
});
});
</script>
你试过把你的AJAX URL粘贴到浏览器中吗? – 2015-04-01 10:57:20
使用一些REST客户端添加为Firefox和测试REST网址.... – 2015-04-01 11:00:44
您的AJAX调用成功,但返回null。 – 2015-04-01 11:04:04