How do I pull rss feeds into jQuery tabs?

房东的猫 提交于 2019-12-12 04:21:55

问题


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 possible?


回答1:


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.




回答2:


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




回答3:


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



来源:https://stackoverflow.com/questions/5800769/how-do-i-pull-rss-feeds-into-jquery-tabs

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!