1

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?

2
  • Looks like a cross-domain request. Perhaps IE doesn't support cross-domain requests?
    – beatgammit
    Aug 7, 2011 at 12:26
  • I cannot check with api doc now, but isn't second arg in that func data to post? Try add null as second arg, I'm probably wrong but it is a few seconds check Aug 7, 2011 at 12:33

3 Answers 3

1

Based on one of those links you have cited, it appears there may be a work around.

Try adding &format=jsonp&callback=? to the URL.

I think jQuery might call the callback you specify anyway if you add the callback parameter.

1
  • Unfortunately, adding either or both causes it to fail in all browsers... it seems they aren't supported by the SimpleGeo API. Trying to find a work around... vexing as it works great in all but IE and I can easily see the data by going to: http://api.simplegeo.com/1.0/features/categories.json
    – mmartimo
    Aug 7, 2011 at 14:28
1

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...

1

jQuery.support.cors = true; that's it

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.