0

I made a script to parse an XML-file with jQuery and as it's on an other domain I used YQL as a proxy.

The script works well in Chrome, Safari, FF. I can see the XML-file when using the IE Developer tools, but it doesn't seem to run anything after the first ajax-call. Regarding Opera If someone has a fix similar to the XDomainRequest for IE, that would be appriciated, but not as important as solving it for IE. I would like to solve this if possible by not using jsonp-data.

$(document).ready(function() {

// detect IE CORS transport
if ('XDomainRequest' in window && window.XDomainRequest !== null) {

  // override default jQuery transport
  $.ajaxSettings.xhr = function() {
      try { return new XDomainRequest(); }
      catch(e) { }
  };

  // also, override the support check
  jQuery.support.cors = true;
    //runs in IE
    alert('hi1');
}
// ajax call to get the xml-data from the YQL console
$.ajax(
    //runs in IE
    alert('hi2'),
    {
    url: 'http://query.yahooapis.com/v1/public/yql?q=select%20*%20%0A%20%20%20from%20xml%20%0A%20%20where%20url%3D%22https%3A%2F%2Fwww.lightbet.com%2Fxmlfeeds.aspx%3Ftype%3DCasinoJackpots%22&diagnostics=true',
    type: 'GET',
    dataType: 'xml',
    success : function(xml) {

    //doesn't run in IE
    alert('hi3');

    // Run the function for each Game tag in the XML file
    $('Game',xml).each(function game(i) {
        var $this = $(this),
            game = $this.attr("name") 

    // appned all the game names to a div
    $("#game_name").append(game);
    //doesn't run in IE
    alert('hi4');

    });
}});

});

4

1 に答える 1

0

チケットhttp://bugs.jquery.com/ticket/8283があったので、最初にjQueryバグレポートサイトに行くべきでした

jaubourg によるこの素晴らしいプラグインにより、非常にスムーズになります: https://github.com/tlianza/ajaxHooks/blob/master/src/ajax/xdr.js

また、誰かがOperaのプラグインや何らかの修正を入手した場合、それは非常に高く評価されます.

于 2012-05-31T14:19:38.613 に答える