By every browser, I mean Safari, Firefox, Chrome, and IE9.
Here is the error I’m getting in IE8’s console:
'data.cities[...].country' is null or not an object
Line 374, which is below (var country = k.data.cities[i].country;):
downloadUrl(url, function(data) {
var k = eval("(" + data.responseText + ")");
var klength = k.data.cities.length;
var countries = [];
for(i=0; i < klength; i++) {
var country = k.data.cities[i].country;
countries.push(country);
}
countries = $.unique(countries);
var countryLength = countries.length;
for(i=0; i < countryLength; i++) {
$('.ribbon').append('<a href="#" class="country '+ countries[i] +'">' + countries[i] + '</a>');
}
});
Why would IE8 be the only browser having a problem with this line? I know the data being fed is not null, as the same data is used to place objects on a map and they display just fine.
I suspect that the eval() function doesn’t return what you expect.
You might want to try using JSON.parse instead.
You can find a parser there for browsers that don’t have native support for JSON.