Question

I've been struggling to get this to work for a while. Basically I want to get information from Yahoo via the YQL resource. I have it working for all browsers except IE. (IE8 is the only one I've tested, but it's a must).

A fiddle here.

$.ajax({
    type: 'GET',
    dataType: 'jsonp',
    crossDomain: true,
    url: 'http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20json%20where%20url%3D%22http%3A%2F%2Ffinance.yahoo.com%2Fwebservice%2Fv1%2Fsymbols%2Fyhoo%2Fquote%3Fformat%3Djson%22%20and%20itemPath%20%3D%20%22list.resources.resource.fields%22&format=xml&callback=?',
    success: function(data) {
        console.log(data);
        name = $($(data.results[0]).find('name')[0]).text();
        symbol = $($(data.results[0]).find('symbol')[0]).text();
        price = $($(data.results[0]).find('price')[0]).text();
        price = parseInt(price);
        $('body').append(name + '; ' + symbol + '; ' + price);
    }
});

The YQL request (for the console):

select * from json where url="http://finance.yahoo.com/webservice/v1/symbols/yhoo/quote?format=json" and itemPath = "list.resources.resource.fields"

It's a simple Ajax get call, but I can't seem to get access for IE8 to do anything with the data. (The return dataType that you see in the URL doesn't matter-- I've tried it with both XML and JSON). Am I missing something? Or is this even possible?

Was it helpful?

Solution

In your example you are using jQuery-2.0.2 but since jQuery-2.0 it dropped the support for IE-6/7/8. From jQuery 2.0 Released | Official jQuery Blog :

No more support for IE 6/7/8: Remember that this can also affect IE9 and even IE10 if they are used in their “Compatibility View” modes that emulate older versions. To prevent these newer IE versions from slipping back into prehistoric modes, we suggest you always use an X-UA-Compatible tag or HTTP header. If you can use the HTTP header it is slightly better for performance because it avoids a potential browser parser restart.

Here is a working fiddle using jQuery-1.9.1.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top