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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T19:10:06+00:00 2026-05-17T19:10:06+00:00

I have 3 javascript methods. isLogin(); login(); reply(); when I’ll execute the reply method

  • 0

I have 3 javascript methods.

isLogin();
login();
reply();

when I’ll execute the reply method then first of all it should check that user is Login or not. If user is login then execute the reply method. If user is not login then execute it first and then execute reply method.

These are all Facebook Javascript SDK methods which are asynchronous. Therefore they don’t return a value.

if for instance these are not async methods then these can return value, on which I can take decesion like this.

function isLogin(){
if(user.islogin()){
return true
}
else{
return false;
}

function login(){
if(user.hasLogin()){
return true;
}
else{
return false;
}

function reply(){

if(!isLogin(){  //User is not login
   if(login()){ //Login User
      //user has login. now reply
     sendText(); //any statement which will reply
   }
}

}

Please help

Thanks

  • 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-05-17T19:10:07+00:00Added an answer on May 17, 2026 at 7:10 pm

    I don’t have experience with the Facebook JavaScript API, but from looking over their documentation briefly, the FB.getLoginStatus and FB.login methods do in fact return values.

    Asynchronous methods can return values, they’re just performed in a “non-blocking” manner (the main program flow doesn’t halt to wait for them to complete). That’s what JavaScript “callback” functions are used for. Your script can continue doing other things after making the API request, and the callback function will get fired when the API returns it’s response.

    FB.getLoginStatus(function(response) {
      if (response.session) {
        // logged in and connected user, someone you know
      } else {
        // no user session available, someone you dont know
      }
    });
    

    The inner function (starting with function(response)) is the callback function, which will fire when the Facebook API returns it’s response to your script.

    Calling the FB.login method will pop up a login window to the user. Your page will continue functioning while this window is open (as it is asynchronous to your program), and the FB.login callback function will fire once the user has either logged in or cancelled the login process.

    For more explanation of how to use the Facebook JavaScript API methods, it’s always useful to read the documentation.

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

Sidebar

Related Questions

I'm creating my own JavaScript Array-like object and I have methods that call closures.
I have a JavaScript method that I need to run on one of my
I have seen the following methods of putting JavaScript code in an <a> tag:
I have several update methods in a javascript file, used for updating my ajax
I have stumbled into several methods of looping in JavaScript, what I like the
In JavaScript nested functions are very useful: closures, private methods and what have you..
Currently, I don't really have a good method of debugging JavaScript in Internet Explorer and
I have a javascript function that manipulates the DOM when it is called (adds
I have a JavaScript widget which provides standard extension points. One of them is
We have a JavaScript function named move which does just windows.location.href = any given

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.