$ .ajax返回XML Feed的空数据

时间:2014-10-30 18:25:16

标签: javascript jquery ajax xml rss

我有一个使用此代码

加载XML RSS Feed网址http://feeds.contenthub.aol.com/syndication/2.0/feed/53dfbdcb7bf94的函数
$(function() {
//      var proxy = 'http://ads.pictela.net/a/hurler.json?feed=';
      var proxy = 'http://ads.pictela.net/a/hurler.json?feed=';
      if(/*proxyRequired*/false) {
        var url = proxy + encodeURIComponent(rssUrl);
        var dataType = 'jsonp';
      } else {
        url = "http://ads.pictela.net/a/hurler.xml?feed=http%3A%2F%2Ffeeds.contenthub.aol.com%2Fsyndication%2F2.0%2Ffeed%2F53dfbdcb7bf94";
        dataType = 'xml';
      }
      this.loadSettings = {rssUrl:rssUrl, callback:callback, proxyRequired:proxyRequired};
      $.ajax({
        type: 'GET',
        url: url,
        cache: true,
        timeout: 7000,
        dataType: dataType,
        error: function() {
            console.log("Here");
          if(_this.loadAttempts < 4) {
            if(_this.config['Backup feed file']){
              _this.loadBackupFile(callback, _this.config['Backup feed file'], true);
            } else {
              _this.loadBackupFile(callback, _this.config['Custom feed file'], true);
            }
          }
        },
        **jsonpCallback: 'jsonpCallback',
        success: function(json) {
                        console.log(JSON.stringify(json));**

          if(_this.loadAttempts < 3 && _this.backupLoadAttempted === false) {
            callback(json, _this);
            //console.log(callback);
          } else {
            if(_this.config['Backup feed file']){
              _this.loadBackupFile(callback, _this.config['Backup feed file'], true);
            } else {
              _this.loadBackupFile(callback, _this.config['Custom feed file'], true);
            }
            _this.backupLoadAttempted = true;
          }
        }

代码

jsonpCallback: 'jsonpCallback',
            success: function(json) {
                            console.log(JSON.stringify(json));

我在IE中返回的rssResponse为null,而它在其他浏览器中正常工作。请帮我弄清楚为什么没有为IE处理XML Feed Url的Ajax GET请求。

问题是数据类型:IE不能使用xml 你能建议我解决这个问题吗? 感谢致敬 斯瓦拉杰

0 个答案:

没有答案