0

FB.api を使用してウォールにメッセージを投稿しようとしました。しかし、私は何の応答も得ていません。手伝っていただけませんか。私のコードを一度確認してください。

function shareWithFacebook(content) {
    FB.api('/me/feed', 'post', {
        message: content
    }, function (response) {        
        if (!response || response.error) {            
            alert('Error : ' + response.error);
        } else {
            alert('Post ID: ' + response.id);            
        }
    });
    return false;
}
4

2 に答える 2

1

この例を試してください

<script>
var publish = {
  method: 'feed',
  message: 'getting educated about Facebook Connect',
  name: 'Connect',
  caption: 'The Facebook Connect JavaScript SDK',
  description: (
      'A small JavaScript library that allows you to harness ' +
      'the power of Facebook, bringing the user\'s identity, ' +
      'social graph and distribution power to your site.'
  ),
  link: 'http://www.fbrell.com/',
  picture: 'http://www.fbrell.com/public/f8.jpg',
  actions: [
    { name: 'fbrell', link: 'http://www.fbrell.com/' }
  ],
  user_message_prompt: 'Share your thoughts about RELL'
};

FB.ui(publish, Log.info.bind('feed callback'));
</script>
于 2012-08-31T13:07:10.787 に答える
0

コードに問題はありません:

FB.api('/me/feed', 'post',
        { message: content },
        function(response) {        
           if (!response || response.error) {            
               alert('Error : ' + response.error);
           } else {
               alert('Post ID: ' + response.id);            
           }
        }
);

認証されていることと、関数 shareWithFacebook を適切に呼び出していることを確認してください。

于 2012-08-31T13:00:27.627 に答える