0

I have an RSS Feed which returns XML. I am trying to use this in jQuery via an AJAX call:

$.ajax({    
  url: "https://www.ctvnews.ca/rss/ctvnews-ca-top-stories-public-rss-1.822009",
  success: function(data) {
  console.log(data);
}

All this does is return the data in XML format. How can I use that? Or convert it JSON data?

Rory McCrossan
  • 331,213
  • 40
  • 305
  • 339
user979331
  • 11,039
  • 73
  • 223
  • 418
  • You don't want to convert it to JSON. You can work with the XML directly. You can simply loop through and traverse it exactly as you would any other standard jQuery object. – Rory McCrossan Jul 24 '18 at 15:52
  • @RoryMcCrossan Can you show me an example of this? – user979331 Jul 24 '18 at 15:53
  • 1
    Here's just a few examples from a cursory search: https://stackoverflow.com/questions/3957932/whats-the-best-way-to-parse-xml-response-in-ajax, https://stackoverflow.com/questions/10575079/parsing-xml-using-jquery-and-ajax, http://www.jquerybyexample.net/2012/04/read-and-process-xml-using-jquery-ajax.html – Rory McCrossan Jul 24 '18 at 15:54

0 Answers0