Using jQuery.getJSON in Chrome Extension

后端 未结 5 793
遥遥无期
遥遥无期 2020-12-30 13:54

I need to do a cross-domain request in a chrome extension. I know I can it via message passing but I\'d rather stick to just jQuery idioms (so my javascript can also work as

5条回答
  •  执笔经年
    2020-12-30 14:36

    The syntax is a little off. There's no need for the callback( bit. This works flawlessly. Tested in the javascript console of Chrome on this StackOverflow page (which includes jQuery):

    $.getJSON("http://api.flickr.com/services/feeds/photos_public.gne?tags=cat&tagmode=any&format=json&jsoncallback=?", function(data) {
      console.log(data);
    });
    

提交回复
热议问题