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

  • SEARCH
  • Home
  • 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 8345615
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T06:44:18+00:00 2026-06-09T06:44:18+00:00

I have a application in which I have to FB.api(/me) FB.api(/me/friends). I want once

  • 0

I have a application in which I have to

FB.api(/me)
FB.api(/me/friends).

I want once the user is authenticated to login to a new page for which I will be having window.location.href.(xx).

so my pesduocode is :

checkuserdetails()
{
FB.api(/me)
FB.api(/me/friends).
window.location.href.(xx).

}

I have alerts in the call back functions and they never get executed and the page gets redirected. as suggested by CBroe I have kept the window.location.href. in the cal back.
But that is also having issues.

its like thiis:

pseduo code:
    checkuserdetails()
    {
    FB.api(/me)
    FB.api(/me/friends){    window.location.href.(xx).}.    
    }

The Alerts in friends will never get executed.

pseduo code:
checkuserdetails()
{
FB.api(/me) { window.location.href.(xx).}.
FB.api(/me/friends)

}

Both alerts are executed.

my questions:
1) some times I see alerts from /me/friends getting executed first and some times in /me. I understand FB is asyncronous how to make ut sequentical…If I have lot of FB.api calls (more than 2) how where to keep the windows.location? how to control the asyncronous functionality

  • 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-09T06:44:19+00:00Added an answer on June 9, 2026 at 6:44 am

    All API calls are asynchronous, so if you need to execute something after all of these have completed then you need to either make them execute in series (not advised for perf), or in parallell with synchronization.

    For this you can use patterns such as Promises, or Futures, or something as simple as

    var results = [], done = 0;
    function allDone(d1, d2) {
      // do something with d1 and d2
    }
    
    FB.api('/...', {..}, function(data) {
      results[0] = data;
      if (done === 2) {
        allDone.apply(null, results);
      }
    });
    
    FB.api('/...', {..}, function(data) {
      results[1] = data;
      if (done === 2) {
        allDone.apply(null, results);
      }
    });
    

    This can of course be abstracted into some helper functions..

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

Sidebar

Related Questions

I have been working on a facebook application which will be using Graph API
I have a script in my facebook application which will provide the user with
I have made an application which allows a user to login using their facebook
I have an iPhone application which basically is getting information from an API (in
I have an application which logs in into a webservice. I start a new
We have a desktop application which needs to expose API. Some people say: API
I have an application which e-mails confirmations. The email part utilises Commons Mail API.
I have made a application which reads information from an Api. Link : http://api.amp.active.com/camping/campground/details?contractCode=CO&parkId=50032&api_key=2chxq68efd4azrpygt5hh2qu
I have an application in which I'm trying to implement the LibPusher API for
I have an asp.net web api application which is acting as a Relay to

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.