title: Get facebook friends list in js api
body: <pre><code>I am getting user info but unable to get friend list.    
  
  &lt;script&gt;
      function sortMethod(a, b) {
          var x = a.name.toLowerCase();
          var y = b.name.toLowerCase();
          return ((x &lt; y) ? -1 : ((x &gt; y) ? 1 : 0));
      }
  
      window.fbAsyncInit = function() {
          FB.init({ appId: 'xxxxxxxxx', 
              status: true, 
              cookie: true,
              xfbml: true,
              oauth: true
          });
  
          function updateButton(response) {
              var button = document.getElementById('fb-auth');
  
              if (response.authResponse) { // in case if we are logged in
                  var userInfo = document.getElementById('user-info');
                  FB.api('/me', function(response) {
                      userInfo.innerHTML = '&lt;img src="https://graph.facebook.com/' + response.id + '/picture"&gt;' + response.name;
                      button.innerHTML = 'Logout';
                  });
  
                  // get friends
                  FB.api('/me/invitable_friends', function(response) {
                      var result_holder = document.getElementById('result_friends');
                      var friend_data = response.data.sort(sortMethod);
  
                      var results = '';
                      for (var i = 0; i &lt; friend_data.length; i++) {
                          results += '&lt;div&gt;&lt;img src="https://graph.facebook.com/' + friend_data[i].id + '/picture"&gt;' + friend_data[i].name + '&lt;/div&gt;';
                      }
  
                      // and display them at our holder element
                      result_holder.innerHTML = '&lt;h2&gt;Result list of your friends:&lt;/h2&gt;' + results;
                  });
  
                  button.onclick = function() {
                      FB.logout(function(response) {
                          window.location.reload();
                      });
                  };
              } else { // otherwise - dispay login button
                  button.onclick = function() {
                      FB.login(function(response) {
                          if (response.authResponse) {
                              window.location.reload();
                          }
                      }, {scope:'email'});
                  }
              }
          }
  
          // run once with current status and whenever the status changes
          FB.getLoginStatus(updateButton);
          FB.Event.subscribe('auth.statusChange', updateButton);    
      };
  
      (function() {
          var e = document.createElement('script'); e.async = true;
          e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
          document.getElementById('fb-root').appendChild(e);
      }());
      &lt;/script&gt;
  </code></pre>
  
  <p>user getting logged in but
  Unable to display facebook friends list.</p>
  
  <p>Code was working before new sdk.
  using invitable_friends before it was me/friends.</p>
  
  <p>anyone please help.</p>
  
  <p>and also is there any way besides this ?</p>