Correct Javascript to get JSON info from Facebook Graph Query -



Correct Javascript to get JSON info from Facebook Graph Query -

i trying url photos of facebook page.

how 'source' url query , json structure:

https://developers.facebook.com/tools/explorer/145634995501895/?method=get&path=19292868552%3ffields%3dalbums.fields(photos.fields(source))&version=v2.1

i using success callback jsonp request:

function(response) { (i = 0; < **???response.albums.data.length???**; i++) { alert(**???response.albums.data[i].photos.data[i].source???**) } }

can help me find right construction parts astericks? because has 2 [i]'s think i'm getting confused..

you need create sure have in head:

<script type='text/javascript' src='//connect.facebook.net/en_us/sdk.js'></script> <script type='text/javascript' src='workfrompage.js'></script>

now on workfrompage.js

var pre = onload; onload = function(){ if(pre)pre(); if(!fb)reload(); var photourls = []; // alter userid // create sure test login , wrap around code below, if needed fb.api('/userid/albums', function(resp){ if(resp && !resp.error){ for(var in resp){ fb.api('/'+resp[i].id+'/photos', function(r){ if(r && !r.error){ for(var n in r){ photourls.push(r[n].source); } // access photourls here } } } } } }

javascript json facebook graph

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -