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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T01:34:48+00:00 2026-06-06T01:34:48+00:00

Like a person asked here (but his solutions as to call a nother function)

  • 0

Like a person asked here (but his solutions as to call a nother function) https://stackoverflow.com/a/10796326/315200 …I would like to know if its possible to have a function which doesn’t call a second function on response of an async request, but simply return when the async request responses.

Something like this maybe:

function callToFacebook() {
    var fbResponse;

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

    return fbResponse; //Will return undefined because CallToFacebook is async
}

Isn’t that possible some way, without calling another function??

What I’m trying to achieve is to have one function I can call with some parameters, which will return the response object from a async webservice, like FB.

  • 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-06T01:34:49+00:00Added an answer on June 6, 2026 at 1:34 am

    In short, no. You cannot have an asynchronous function return a meaningful value synchronously, because that value does not exist at that time (as it is built asynchronously in the background).

    You can, however, return a Promise object, representing the “potential return value” of the asynchronous operation, and bind a function to that object using done() or similar. That way, your function gets return semantics (instead of having to chain the control flow into a callback), and remains asynchronous.

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

Sidebar

Related Questions

A question like this was asked before and the person got nothing but criticisms,
Looks like this question has been asked thousand times already, but each person's configuration
I asked a similar question here a while back but all the answers were
I am using the patch queue to achieve something like what this person asked
Sorry I know similar question have been asked many times before but like most
Now, I don't have any problems with 301 redirects, but one person asked me
Take some code like if (person.IsMale()) { doGuyStuff(); } else { doGirlStuff(); } Should
I have three tables like this: Person table: person_id | name | dob --------------------------------
My database structure looks something like this: Person Id Name FieldA FieldB Phone Id
I have a dataframe that looks like this: person n start end 1 sam

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.