2
我使用圖形API搜索的組,這裏是http請求:Javascript - 如何解析JSON圖中的PHP API從HTTP獲取?
var url ="https://graph.facebook.com/search?type=group&q=house&access_token=access_token&callback=FB.__globalCallbacks.f317bdb78&limit=5&method=get&pretty=0&sdk=joey".
$.get(url, function(resp) {
console.log(resp);//it's return resp
var obj = jQuery.parseJSON(resp.data);//I got error here, resp.data is undefined
console.log(obj);
});
這是從圖形API響應:
/**/ FB.__globalCallbacks.f317bdb78({"data":[{"name":"House Party !!!","privacy":"CLOSED","id":"881671771927203"},{"name":"KITTY'S HOUSE","privacy":"OPEN","id":"100126236854592"},{"name":"Full House Long Xuy\u00ean","privacy":"OPEN","id":"606749376035865"},{"name":"Housing Ho Chi Minh City (Saigon)","privacy":"CLOSED","id":"330339417123482"},{"name":"Ch\u0103n Drap House","privacy":"OPEN","id":"1397025403874006"}],"paging":{"cursors":{"before":"MAZDZD","after":"NAZDZD"},"next":"https:\/\/graph.facebook.com\/v2.0\/search?access_token=access_token&pretty=0&q=house&type=group&limit=5&after=NAZDZD"}});
如何從響應曲線圖上搜索Facebook的解析JSON數據?