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 8379937
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:19:19+00:00 2026-06-09T16:19:19+00:00

I’m trying to fetch albums list from facebook via JavaScript and Graph API. I’m

  • 0

I’m trying to fetch albums list from facebook via JavaScript and Graph API. I’m doing it like this:

FB.api('/me/albums', function(response){
    //
});

Album covers coming back as photo id, not a url that I can insert into html. So, I need to get a urls in second step. But, by application design, I can’t get urls later and insert images. I need to return a complete data object with album propereties (id, name, cover url). My last try is listed below:

FB.api('/me/albums', { fields : 'id,name,count,cover_photo' }, function(response){

    if (!response || response.error) {
        callback.call(false);
        return;
    };

    var parsed = $(response.data).map(function(){

        if (this.count > 0) {

            var result = {
                aid : this.id,
                title : this.name,
                cover : this.cover_photo
            };

            return result;
        };
    });

    for (var i = 0; i < parsed.length; i++) {

        (function(i){

            FB.api('/' + parsed[i].cover, { type : 'album' }, function(response){
                parsed[i].thumb = response.picture;
            });

        })(i);

    };

    callback.call(parsed);
});

The problem is that the loop is not waiting for cover queries and going forward, leaving return object without cover urls. I think it’s can not be so difficult to do, but I can’t find the solution long enough. Any ideas are welcome.

  • 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-09T16:19:20+00:00Added an answer on June 9, 2026 at 4:19 pm
    window.getAlbums = function() {
    FB.api({
         method: 'fql.multiquery',
         queries: {
            query1: 'select aid,name,link,photo_count,cover_object_id from album where owner = me()',
            query2: 'SELECT pid,src FROM photo WHERE object_id  IN (SELECT cover_object_id FROM #query1)'
         }
        },
        function(response) {
            var parsed = new Array();
            $(response[0].fql_result_set).each(function(index,value){
                    var result = {
                aid : value.aid,
                title : value.name,
                cover : response[1].fql_result_set[index].src,
                                link :value.link
            };
                    parsed.push(result);
            })
        getdata(parsed);
    });
    

    };

    Apped your album detail using

    function getdata(data){
    
    $(data).each(function(index,value){
        // console.log(value.aid + ' - '+ value.cover+ ' - '+ value.title );
        $("#fb_albumb").append('<h3>'+ value.title +'</h3><a href="'+ value.link  +'" target="_blank" ><img src="'+ value.cover +'" title="'+ value.title +'" /></a><br/>');
    })
    

    }

    HTML

    <fb:login-button scope="user_photos" onlogin="getAlbums()">Grant Permissions to Allow access to Photos and Albums</fb:login-button>
    

    May be this will help you.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
Does anyone know how can I replace this 2 symbol below from the string
I have some data like this: 1 2 3 4 5 9 2 6
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i

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.