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);
            }    
        });
    });
}
4
  • Have you tried the solution posted here? stackoverflow.com/questions/12519021/… Commented Mar 11, 2019 at 16:34
  • Not working for me. Find is not a function :( Commented Mar 11, 2019 at 18:03
  • Can you create a JSFiddle to replicate the issue? Commented Mar 12, 2019 at 9:35
  • this code work on my localhost, except I, can't get media:content url jsfiddle.net/u068m47j/1 RSS feed is the same as above except there is +100 items Commented Mar 12, 2019 at 11:44

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.