menu

Thursday, 16 January 2014

get response after sharing with Facebook feed dialog?

<body>
    <div id='fb-root'></div>
    <script src='http://connect.facebook.net/en_US/all.js'></script>
    <p><a onclick='postToFeed(); return false;'><img src="RANDOM IMAGE.png" alt="IMAGE"/></a></p>
    <p id='msg'></p>

        <script> 
          FB.init({appId: "1234567890", status: true, cookie: true});

          function postToFeed() {

            // calling the API ...
            var obj = {
              method: 'feed',
              link: 'https://developers.facebook.com/docs/reference/dialogs/',
              picture: 'http://fbrell.com/f8.jpg',
              name: 'Facebook Dialogs',
              caption: 'Reference Documentation',
              description: 'Using Dialogs to interact with users.'
            };

            function callback(response) {
              document.getElementById('msg').innerHTML = "Post ID: " + response['post_id'];
            }`enter code here`

            FB.ui(obj, callback);
          }
        </script>
  </body>

No comments:

Post a Comment