0

I'm trying to parse a xml with jQuery. I can get title, description, but I can't read out img url from media:content. I have tried with item.media.content.url XML-

<item>
  <title>None</title>
  <link>https://www.ip.com</link>
  <description>Mohahah</description>
  <guid>files</guid>
  <pubDate>Mon, 11 Mar 2019 12:57:06 +0100</pubDate>
  <dc:creator>TT</dc:creator>
  <media:content type="image/jpeg" url="files/images/.jpg">
    <media:credit scheme="urn:ebu">rant</media:credit>
    <media:description></media:description>
  </media:content>
</item>

Code

 function loadXML (xml_url, url, color, wcolor ) {
    jQuery(function() {
        jQuery.getFeed({
            url: xml_url,
            success: function(feed) {
                var html = '';
                for(var i = 0; i < feed.items.length; i++) {            
                    var item = feed.items[i];

                    html +='<article class="white-panel" style="background-color:#' + color + '">'      
                    + '<h5 style="color:#' + wcolor + '">' + url + '</h5>'
                    + item.media.url
                    +'<h4><a href="' + item.link + '" target="_blank" rel="noopener noreferrer" >' + item.title + '</a></h4>'
                    + '<a href="' + item.link + '" target="_blank" rel="noopener noreferrer" >' + item.description + '</a>'
                    + '</article>'

                }

                jQuery('#pinBoot').append(html);
            }    
        });
    });
}
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Johan
  • 5
  • 6

0 Answers0