Hi, down below i am working on a RSS Feed code this code parse the feed from external server onto my browser. The problem is that this code parse the whole feed from the server but i need to parse only some of the information like: I want to parse only that item which matches with the string values say “windsor to Toronto” i only want to parse that item which match up with this string in description tag. I tried using for loop but didn’t workout. So, Here’s the actual code:
$(document).ready(function() {
let feed="https://www.rssmix.com/u/9380040/rss.xml";
console.log(feed);
$.ajax(feed, {
accepts:{
xml:"application/rss+xml"
},
header: {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': 'POST, GET, OPTIONS'
},
dataType:"xml",
crossDomain: true,
success:function(data) {
$(data).find("item").each(function () {
var el = $(this);
console.log("------------------------");
var titleU= el.find("title").text();
var title= titleU.toLowerCase();
var link= el.find("link").text();
var description= el.find("description").text();
console.log(title);
console.log(description);
var find1= "windsor"
var find2= "toronto"
//Destination
var destination= new RegExp('\\w*' + find1 + ' to ' +find2, 'ig');
var dest=title.match(destination)
console.log(dest);
});
}
});
});