O'Reilly logo

Facebook Application Development with Graph API Cookbook by Apeksha Singh, Shashwat Srivastava

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using Dialog to add someone as a friend

One of the amazing features of Facebook is to search for people and make them friends. We can directly use Facebook Friends Dialog, if we want to add someone as a friend. It provides us with an elegant interface where we can send a friend request to someone just with a mouse click.

Getting ready

You should have setup index.php, as explained in the beginning of the chapter.

How to do it...

The following steps will demonstrate how to use Dialog to add friends:

  1. Open index.php and add the following highlighted code inside the div fb-root as shown:
    <div id="fb-root">
      <input type="button" id="launch" value="Launch" /><br />
    </div>
  2. Next, add the following highlighted code to the function assigned to window.fbAsyncInit ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required