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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:41:33+00:00 2026-06-12T16:41:33+00:00

I have a simple facebook validation i would like to implement to my jQuery

  • 0

I have a simple facebook validation i would like to implement to my jQuery button.
When the user clicks the button it should check if logged in, if TRUE then change the text.
I found this article which talks about returning a true/false state but when i tried to implement it in my code it didnt work.

Any suggestion where im going wrong please, thank you.

function fb_loginCheck(){
    FB.getLoginStatus(function(response, e) {
        if (response.status === 'connected') {
            var uid = response.authResponse.userID;
            var accessToken = response.authResponse.accessToken;
            e.returnValue = true;
        } else if (response.status === 'not_authorized') {
            // the user is logged in to Facebook, but has not authenticated your app
            fb_oAuth();
            e.returnValue = false;
        } else {
            // the user isn't logged in to Facebook.
            fb_oAuth();
            e.returnValue = false;
        }
    }, true);
}


$('.myBttn').click(function(){

    var io = return fb_loginCheck();
    if (io){
        $this = $(this).text();
        if($this == 'yes')
            $(this).text('no');
        else
            $(this).text('yes');
    }

    return false;
});

got it to work:
similar to potench answer but removing the e.returnValue did it

function fb_loginCheck(callBack){
    FB.getLoginStatus(function(response) {
        if (response.status === 'connected') {
            var uid = response.authResponse.userID;
            var accessToken = response.authResponse.accessToken;
            callBack(true);
        } else if (response.status === 'not_authorized') {
            fb_oAuth();
            callBack(false);
        } else {
            fb_oAuth();
            callBack(false);
        }
    }, true);
}
  • 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-12T16:41:34+00:00Added an answer on June 12, 2026 at 4:41 pm

    Something like this might work. I’ve moved the methods around so they get fired when a response is returned from the FB.getLoginStatus method.

    I’m passing in a callBack method which fires when the response from FB.getLoginStatus returns a result. Also note that I’ve had to re-scope the $(this) variable.

    function fb_loginCheck(callBack){
        FB.getLoginStatus(function(response, e) {
            if (response.status === 'connected') {
                var uid = response.authResponse.userID;
                var accessToken = response.authResponse.accessToken;
                e.returnValue = true;
                callBack(true);
            } else if (response.status === 'not_authorized') {
                // the user is logged in to Facebook, but has not authenticated your app
                fb_oAuth();
                e.returnValue = false;
                callBack(false);
            } else {
                // the user isn't logged in to Facebook.
                fb_oAuth();
                e.returnValue = false;
                callBack(false);
            }
        }, true);
    }
    
    
    $('.myBttn').click(function(){
        var targ = $(this);
    
        fb_loginCheck(function (io) {
            targ.text( (io) ? "yes" : "no" );
        });
    
        return false;
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple Desktop Facebook application that allows the user to retrieve some
I have a facebook app and a user logs in and uses it. Simple.
I have created a simple Facebook application in PHP, that greets user by there
I have a simple problem (maybe) with my code... I have a facebook button
I have a simple facebook app . Using some jquery ajax : $.ajax({ url:
I'm implementing a simple Facebook Like button on a voting site but want an
I have simple facebook connect plugin on a wordpress blog and have integrated the
Okay this question is very simple: I have a facebook page, and a website.
I have an extremely simple page that I'm trying to view in the Facebook
I have a very simple question. In FB tutorial https://developers.facebook.com/docs/mobile/ios/build/ it starts to login

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.