Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://www.economist.com/sections/asia/rss.xml. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).
- $(document).ready(function() {
- //feed to parse
- var feed = "https://www.economist.com/sections/asia/rss.xml";
- $.ajax(feed, {
- accepts:{
- xml:"application/rss+xml"
- },
- dataType:"xml",
- dataType : 'jsonp',
- success:function(data) {
- //Credit: http://stackoverflow.com/questions/10943544/how-to-parse-an-rss-feed-using-javascript
- $(data).find("item").each(function () { // or "item" or whatever suits your feed
- var el = $(this);
- console.log("------------------------");
- console.log("title : " + el.find("title").text());
- console.log("link : " + el.find("link").text());
- console.log("description: " + el.find("description").text());
- });
- }
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement