Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8034907
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T02:09:29+00:00 2026-06-05T02:09:29+00:00

I am learning javascript and the Facebook API right now and I am trying

  • 0

I am learning javascript and the Facebook API right now and I am trying to display the users newsfeed. I know the query I need to use but I don’t know how to display the results using javascript. Here is my query

SELECT post_id, actor_id, target_id, message FROM stream WHERE filter_key in (SELECT filter_key FROM stream_filter WHERE uid=me() AND type='newsfeed') AND is_hidden = 0

I am pretty sure a forEach loop to display each result is what I need to do but how would I go about populating each result with the newsfeed post information?

EDIT

Ok here is my new code that does correctly receive the results of the query. Unfortunately, the results just aren’t being shown.

<script>
               
function showPosts() {
    FB.api("/fql?q="+encodeURIComponent("SELECT post_id, actor_id, target_id, message FROM stream WHERE filter_key in (SELECT filter_key FROM stream_filter WHERE uid=me() AND type='newsfeed') AND 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;
  
    for (var i=0; i < posts.length && i < 25; i++) {
      var post = posts[i];
      
     markup += '<div>' + post.postId + post.message + '<div/>';
  }
  
    document.getElementById('newsfeedposts').innerHTML = markup;
  
});
  
</script>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T02:09:30+00:00Added an answer on June 5, 2026 at 2:09 am

    Execute the query via FB.api, and handle the data you’ll be getting back in the callback function.

    FB.api("/fql?q="+encodeURIComponent("SELECT ..."), function(response) {
      console.log(response);
    })
    

    Execute that in Firefox, look into the Firebug console, and you should get an understanding of how the response is constructed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently learning JavaScript, but I'm very weak on the fundamentals. I'm trying to
My background is in java and right now Im getting into learning Javascript. (I'm
I'm just learning JavaScript right now, so please do try and explain with that
I'm learning JavaScript right now, quite a task being new to both the syntax
I'm just beginning learning javascript and jQuery and need some help. I am trying
Im learning javascript right now, so this might be a really newb question! I
am learning javascript and not at a great rate, am trying to use the
I'm learning JavaScript and I'm currently trying to figure out why (in Spidermonkey )
I've been learning JavaScript recently, and I've seen a number of examples (Facebook.com, the
I am learning javascript and I am trying to figure out if there is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.