开发者

MediaRSS parsing in Javascript

开发者 https://www.devze.com 2023-01-07 18:23 出处:网络
I\'m trying to read the Flickr feed in order to parse the images. However, the images are in the media:thumbnail t开发者_如何学Goag. Where would I begin to make a mediaRSS parser? Does anyone have an

I'm trying to read the Flickr feed in order to parse the images. However, the images are in the media:thumbnail t开发者_如何学Goag. Where would I begin to make a mediaRSS parser? Does anyone have an example?


I recommend jQuery.getJSON(). As far as i know Flickr provides a JSON feed.

Here is an example from a current project using jQuery and xml:

$("#loading").show();
$.ajax({
    type: "GET",
    url: "/path",
    dataType: "xml",
    success: parseXml
});

function parseXml(xml) {
    $(xml).find("item").each(function() {
        $("#news_list").append('<p>Content</p>');
        $("#loading").hide();
    });
}

Works awesome! You only have to change the datatype to json.

0

精彩评论

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