我正在使用Google feed API在我的網站中加載RSS。
https://developers.google.com/feed/v1/devguide中提到的過程適用於從鏈接中獲取rss。使用Google API動態rss鏈接的多個Feed在一個網站上
var feed = new google.feeds.Feed("https://stackoverflow.com/feeds");
//other Codes
google.setOnLoadCallback(myFunction);
我的情況是在我的網站動態加載多個RSS提要的一個實例鏈接
例如,如果鏈接如下:
- http://www.codeplex.com/site/feeds/rss
- https://stackoverflow.com/feeds
- http://fastpshb.appspot.com/feed/1/fastpshb/rss
$('li').each(function(index, value)
{
var text = $(this).text();
var feed = new google.feeds.Feed(text);
});
//Other Codes
google.setOnLoadCallback(myFunction);
只提取最後一個鏈接的rss。
在這個環節https://developers.google.com/feed/v1/reference#resultFind
中提到,
.setOnLoadCallback(回調)是註冊指定的處理函數被調用靜態函數一次包含此調用加載頁面,在回調時調用所需的功能包含文檔被加載並且API可以使用(例如,在onLoad之後)。
難道這就是.setOnLoadCallback執行最後一個鏈接的原因嗎?
這個問題的解決方案是什麼?