用jQuery解析RSS [英] Parse RSS with jQuery

查看:96
本文介绍了用jQuery解析RSS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用jQuery解析RSS feed.可以使用现成的基本jQuery库完成此操作,还是需要使用插件?

I want to use jQuery to parse RSS feeds. Can this be done with the base jQuery library out of the box or will I need to use a plugin?

推荐答案

警告

Google Feed Feed 已正式弃用不再起作用


不需要整个插件.这会将您的RSS作为JSON对象返回到回调函数:


No need for a whole plugin. This will return your RSS as a JSON object to a callback function:

function parseRSS(url, callback) {
  $.ajax({
    url: document.location.protocol + '//ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=10&callback=?&q=' + encodeURIComponent(url),
    dataType: 'json',
    success: function(data) {
      callback(data.responseData.feed);
    }
  });
}

这篇关于用jQuery解析RSS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆