How to query the Facebook Graph API with JSONP

后端 未结 3 933
星月不相逢
星月不相逢 2020-12-18 07:20

Shouldn\'t follow AJAX request with JQuery work?

$.getJSON(\'https://graph.facebook.com/138654562862101/feed?callback=onLoadJSONP\');

I hav

3条回答
  •  囚心锁ツ
    2020-12-18 08:00

    It has to be "callback=?" and then you define the callback as the last parameter of the request.

    $.getJSON("http://api.flickr.com/services/feeds/photos_public.gne?jsoncallback=?",
      {
        tags: "cat",
        tagmode: "any",
        format: "json"
      },
      function(data) {
        $.each(data.items, function(i,item){
          $("").attr("src", item.media.m).appendTo("#images");
          if ( i == 3 ) return false;
        });
      });
    

提交回复
热议问题