我正嘗試使用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