Display Facebook fql.query results with javascript -
i learning javascript , facebook api right , trying display users newsfeed. know query need use don't know how display results using javascript. here query
select post_id, actor_id, target_id, message stream filter_key in (select filter_key stream_filter uid=me() , type='newsfeed') , is_hidden = 0 i pretty sure foreach loop display each result need how go populating each result newsfeed post information?
edit
ok here new code correctly receive results of query. unfortunately, results aren't being shown.
<script> function showposts() { fb.api("/fql?q="+encodeuricomponent("select post_id, actor_id, target_id, message stream filter_key in (select filter_key stream_filter uid=me() , type='newsfeed') , is_hidden = 0"), function(response, post_id, actor_id, message) { console.log(response); var posts = response.data var postid = post_id.data; var message = message.data; (var i=0; < posts.length && < 25; i++) { var post = posts[i]; markup += '<div>' + post.postid + post.message + '<div/>'; } document.getelementbyid('newsfeedposts').innerhtml = markup; }); </script>
execute query via fb.api, , handle data you’ll getting in callback function.
fb.api("/fql?q="+encodeuricomponent("select ..."), function(response) { console.log(response); }) execute in firefox, firebug console, , should understanding of how response constructed.
Comments
Post a Comment