必须只返回描述但返回所有路径json

时间:2013-08-10 19:50:09

标签: javascript jquery json

必须返回每个标题的描述我尝试为每个标题创建路径但是返回all而不是每个。有谁知道怎么办?

的javascript

$.getJSON("http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20xml%20where%20url%3D'http%3A%2F%2Frss.cnn.com%2Fservices%2Fpodcasting%2Fac360%2Frss.xml'%20AND%20itemPath%3D%22%2F%2Fchannel%22&format=json&diagnostics=true&callback=?", function (data) {

    // Load Titles patch Json
    console.log(data.query.results.channel.item);
    var titles = data.query.results.channel.item.map(function (item) {
        return item.title;

    });
    var urls = data.query.results.channel.item.map(function (item) {
        return item.origLink;

    });

    var descri = data.query.results.channel.item.map(function (item) {
        return item.description;

    });

    $(".description-podcast p").text(descri);

    console.log(titles);
    $(".container-list-podcast ul").append('<li>' + titles.join('</li><li>'));
    $(".container-list-podcast ul li").each(function (key, value) {
        var text = $(this).text();
        $(this).html('<a href="' + urls[key] + '">' + text + '</a>');
    });
    // Load Navigation Only Key
    a = $('.nav_holder li a').keynav(function () {
        return window.keyNavigationDisabled;
    });
});

jsfiddle

0 个答案:

没有答案