0

I need to run the fb inside a $.ready to do some checkings. The alert in getLoginStatus function never trigger ?!

<script src="http://connect.facebook.net/en_US/all.js"></script>
    <script type="text/javascript">
    $(function(){
        if(Setting_ShowLike){
            FB.init({
                appId   : 'APP_ID',
                status  : true,
                cookie  : true,
                xfbml   : true,
                oauth   : true,
            });

            FB.getLoginStatus(function(response){
                alert('callback');
            });
        }


    });
    </script>

    <div id="fb-root"></div>
    <div class="fb-like" href="http://www.facebook.com/windows" data-send="false" data-width="450" data-show-faces="false"></div>

1 Answers1

2

You need to move <div id="fb-root"></div> all the way up, right before <script src="http://connect.facebook.net/en_US/all.js"></script>.

It should work fine after that.

Duru Can Celasun
  • 1,621
  • 1
  • 16
  • 28