最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - updateStatusCallback not defined on facebook examble of JQuery - Stack Overflow

programmeradmin3浏览0评论

So, I'm trying to integrate my html with facebook, add facebook login, share, that sort of stuff, but I'm finding a problem. Have searched here and could find the solution for most, but not this one.

It says on the JavaScript console, after I load the html:

Uncaught ReferenceError: updateStatusCallback is not defined.

The code is small, so I'll paste it here.

<html>

<head>
 <script src=".0.0/jquery.min.js"></script>
    <link rel="stylesheet" href="css/style.css" />
    <title>Testes</title>
    <script>

      $(document).ready(function() {
        $.ajaxSetup({ cache: true });
        $.getScript('.js', function(){
        FB.init({
        appId: '383086835168967',
        });     
      $('#loginbutton,#feedbutton').removeAttr('disabled');
      FB.getLoginStatus(updateStatusCallback); <-- Error ocurring on this line. More specicly, on updateStatusCallback. -->
  });
});

    </script>
</head>
</html>

Code found at here

So, I'm trying to integrate my html with facebook, add facebook login, share, that sort of stuff, but I'm finding a problem. Have searched here and could find the solution for most, but not this one.

It says on the JavaScript console, after I load the html:

Uncaught ReferenceError: updateStatusCallback is not defined.

The code is small, so I'll paste it here.

<html>

<head>
 <script src="http://ajax.googleapis./ajax/libs/jquery/2.0.0/jquery.min.js"></script>
    <link rel="stylesheet" href="css/style.css" />
    <title>Testes</title>
    <script>

      $(document).ready(function() {
        $.ajaxSetup({ cache: true });
        $.getScript('https://connect.facebook/en_UK/all.js', function(){
        FB.init({
        appId: '383086835168967',
        });     
      $('#loginbutton,#feedbutton').removeAttr('disabled');
      FB.getLoginStatus(updateStatusCallback); <-- Error ocurring on this line. More specicly, on updateStatusCallback. -->
  });
});

    </script>
</head>
</html>

Code found at here

Share Improve this question edited Jan 8, 2014 at 3:28 flx 14.2k11 gold badges58 silver badges73 bronze badges asked Jan 8, 2014 at 3:07 Miyh0Miyh0 491 silver badge7 bronze badges 1
  • 1 u need to define the updateStatusCallback function – iJade Commented Jan 8, 2014 at 3:10
Add a ment  | 

1 Answer 1

Reset to default 6

That's because the updateStatusCallback logic is left to the developer. You should do:

FB.getLoginStatus(function(){
   alert('Status updated!!');
   // Your logic here
});

Or leave the code as you have it now, but adding this:

function updateStatusCallback(){
   alert('Status updated!!');
   // Your logic here
}
发布评论

评论列表(0)

  1. 暂无评论