JQuery obtains the summary and analysis of cross-origin XML (RSS) data, jqueryxml

Source: Internet
Author: User

JQuery obtains the summary and analysis of cross-origin XML (RSS) data, jqueryxml

Some time ago, the project requires front-end JS to obtain cross-origin XML (RSS). First, we plan to use jQuery. the ajax method is obtained, but the prompt "Access Denied" is a little embarrassing below ie9. The following methods are summarized by searching relevant information on the Internet:

I. google's jGFeed: I believe many people should be familiar with this and use it relatively easily:

Source code:

(function($){ $.extend({  jGFeed : function(url, fnk, num, key){   // Make sure url to get is defined   if(url == null) return false;   // Build Google Feed API URL   var gurl = "http://ajax.googleapis.com/ajax/services/feed/load?v=1.0&callback=?&q="+url;   if(num != null) gurl += "&num="+num;   if(key != null) gurl += "&key="+key;   // AJAX request the API   $.getJSON(gurl, function(data){    if(typeof fnk == 'function')      fnk.call(this, data.responseData.feed);    else    return false;   });  } });})(jQuery);

Call:

JQuery. jGFeed ('xml or RSS path', function (feeds) {console. log (feeds );})

Ii. query YQL of yahoo. Some people may not know much about this method, so please refer to it below:

Var YqlUrl = 'HTTP: // query.yahooapis.com/v1/public/yql? Q = select % 20 * % 20 from % 20xml % 20 where % 20url % 3D "'+ XML or RSS path +'" & format = json & diagnostics = true & callback =? '$. GetJSON (YqlUrl, function (data) {console. log (data )})

The above YqlUrl is copied from the yahoo YQL console. You only need to replace the corresponding file path.

Here we recommend the address controlled by Yahoo YQL, which contains many interesting things (getting weather, WOEID, cross-Origin data, etc.) and can return XML and JSON results.

The above jQuery summary and analysis of cross-origin XML (RSS) data is all the content shared by Alibaba Cloud. I hope you can give us a reference and support for our customer base.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.