title: How to use Graph API to get user's total friend count [JavaScript]
body: <p>After doing some research into Facebook's Graph API v2.8, I finally understand how to craft functions using <strong>JavaScript</strong>. What I would like to specifically do is after I have the user logged into my application, they would click a button that grabs a total of their friend count.</p>
  
  <p>Here is the code I'm attempting to use to accomplish this:</p>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;button onclick="getInfo()"&gt;Get Friend Count&lt;/button&gt;
  </code></pre>
  
  <p><strong>JavaScript</strong></p>
  
  <pre><code>// Get Basic User Info
  // TODO: Get user's friend count
  function getInfo() {
  FB.api('/me/friends', 'GET', {
      fields: 'total_count'
  }, function (response) {
      document.getElementById('status').innerHTML = response.id;
  });
  }
  </code></pre>
  
  <p>Perhaps the fields parameter is wrong?
  The ultimate goal is that I want the total count of friends publicly displayed on a user's profile within my application.</p>
  
  <p><strong>EDIT:</strong> <code>user_friends</code> has been authorized with the access token that I generated, but my response.id comes back as undefined.</p>
  
  <p><strong>EDIT 2:</strong> The data returned using the Graph API Explorer comes in a <strong>JSON</strong> format:</p>
  
  <pre><code>{
  "id": "my_id",
  "name": "my_name",
  "friends": {
  "data": [
  ],
  "summary": {
    "total_count": 161
    }
   }
  }
  </code></pre>