Advertisement
Guest User

Untitled

a guest
Aug 24th, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. 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).
  2.  
  3. $(document).ready(function() {
  4. //feed to parse
  5. var feed = "https://www.economist.com/sections/asia/rss.xml";
  6.  
  7. $.ajax(feed, {
  8. accepts:{
  9. xml:"application/rss+xml"
  10. },
  11. dataType:"xml",
  12. dataType : 'jsonp',
  13. success:function(data) {
  14. //Credit: http://stackoverflow.com/questions/10943544/how-to-parse-an-rss-feed-using-javascript
  15.  
  16. $(data).find("item").each(function () { // or "item" or whatever suits your feed
  17. var el = $(this);
  18. console.log("------------------------");
  19. console.log("title : " + el.find("title").text());
  20. console.log("link : " + el.find("link").text());
  21. console.log("description: " + el.find("description").text());
  22. });
  23.  
  24.  
  25. }
  26. });
  27.  
  28. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement