Parse rss feed using javascript

I am parsing an RSS feed using PHP and JavaScript. First I created a proxy with PHP to get the RSS feed. Then get individual data from this RSS feed using JavaScript. My problem is with JavaScript. I can get the whole JavaScript document if I use it console.log(rssData);without errors. If I try to get the individual elements in this document, say, for example <title>, <description>or <pubDate>using rssData.getElementsByName("title");, it displays an error message "Nekopat TypeError: Object .... does not getElementsByName Method" So, my question is: how to get the items in RSS- channel?

Javascript (updated)

function httpGet(theUrl) {
    var xmlHttp = null;

    xmlHttp = new XMLHttpRequest();
    xmlHttp.open("GET", theUrl, false);
    xmlHttp.send(null);
    return xmlHttp.responseXML;
}

// rss source
var rssData = httpGet('http://website.com/rss.php');

// rss values
var allTitles = rssData.getElementsByTagName("title");    // title
var allDate = rssData.getElementsByTagName("pubDate");    // date
+3
source share
1 answer

httpGet :

return xmlHttp.responseXML;

, XML. PHP-:

header("Content-type: text/xml");

XML.

+3

All Articles