jquerygetjsonsimplegeo

Simple JQuery getJSON is not working in IE9


I am trying to read in the category list from SimpleGeo... my code works fine in Chrome and FireFox, but fails in IE.

$.getJSON("http://api.simplegeo.com/1.0/features/categories.json",function(json){
    sgCategories = json;
});

Looking at a couple other posts seem to offer ideas but the API doesn't seem to offer a callback and I have no control of their format...

https://stackoverflow.com/questions/6514457/getjson-or-ajax-requests-not-working-with-ie9 https://stackoverflow.com/questions/3517608/why-isnt-this-simple-bit-of-jquery-getjson-working-in-ie8

Any other ideas?


Solution

  • So... it turns out that SimpleGeo allows you to get the category list via their javascript client api.

    var sgClient = new simplegeo.Client('yourAccessKey');
    sgClient.getFeatureCategories(function(err, data) {
        if (err) {
            console.log(err);
        } else {
            sgCategories = data;
        };
    });
    

    Tricky...