Showing posts with label HTML5. Show all posts
Showing posts with label HTML5. Show all posts

Wednesday, April 30, 2014

Invite Friends In FACEBOOK with API Apprequest Method Implementation

This sample Code is a Facebook API method implementation which uses Javascript SDK. A simple source code that can invite your friends to use your Facebook Application.

Source Code


 <!DOCTYPE html>
<html>
    <head>
        <title></title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    </head>
    <body>
        <script type="text/javascript">
            window.fbAsyncInit = function() {
                FB.init({
                    appId: "<YOUR-APP-ID>",
                    status: true,
                    cookie: true
                });
            };
            
            // Load the SDK Asynchronously
            (function(d){
                var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
                if (d.getElementById(id)) {return;}
                js = d.createElement('script'); js.id = id; js.async = true;
                js.src = "//connect.facebook.net/en_US/all.js";
                ref.parentNode.insertBefore(js, ref);
            }(document));
            
            function invite_your_friends() {
                FB.ui({
                    method: "apprequests",
                    message: "Check out this Fantastic App!"
                }, invite_your_friends_callback);
            }
            
            function invite_your_friends_callback(response) {
                console.log(response);
            }

  </script>
  <center>
      <a href="javascript:;" onclick="invite_your_friends();">
          <h3>Invite Your Friends and Share this Fantastic App!</h3>
      </a>
  </center>
    </body>
</html>



Genesis Framework for WordPress