开发者

How do I pull rss feeds into jQuery tabs?

I want to set up some tabbed content on my site using jQuery and I want the tabs to pull the rss feeds from another part of the site. It's still the same site, though. Is this possib开发者_Go百科le?


You cant pull cross domain contents. You may use JsonP if the data is available in that format. You can use Yahoo YQL to create a JsonP representation for the rss feed and then call that as yql query using jquery's ajax method. Here is sample yql to convert the rss feed to json format

yql = select * from rss where url ="<feed url>"

and you can use the following url as parameter to ajax/json function in jquery

http://query.yahooapis.com/v1/public/yql?q=yql&format=json&callback=rssLoaded


If the XML documents are on the same domain as your document it can be done with jQuery.ajax() calls, or you can use jQuery plugins to fetch and parse data with jQuery RSS plugins.

If they are on a different domain you can use Yahoo Pipes to transform the remote XMLs to JSONP response which will work with all browsers, or you can use Cross-Origin Resource Sharing (cross domain AJAX) with the new ones.


If you want to process the information, and output it in a different way this should be done through PHP with the use of something like cURL

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜