Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6095403
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:48:29+00:00 2026-05-23T12:48:29+00:00

I am grabbing the facebook pages a user admins and displaying them in a

  • 0

I am grabbing the facebook pages a user admins and displaying them in a select box through the Facebook JS SDK.

What’s the best way to take the array I get back from facebook response.data and iterate so it goes into the select?

  <div id="fb-root"></div>
  <script src="http://connect.facebook.net/en_US/all.js">
  </script>
  <script>
    FB.init({ 
    appId:'119406238144386', cookie:true, 
    status:true, xfbml:true 
    });
    FB.api('/me/accounts/', function(response) {
      alert(response.data);
    });
   </script>
   <select id="pages"></select>
  <fb:login-button perms="manage_pages">Connect to Facebook</fb:login-button>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T12:48:30+00:00Added an answer on May 23, 2026 at 12:48 pm

    Facebook returns the object in an object array, so just loop through each one and add a new html object item to the select list.

    A full working example without jQuery:

    <!DOCTYPE html>
    <html>
    <body>
    <div id="fb-root"></div>
    <a href="#" onclick="getPages();return false;">Get Pages</a>
    
    <select id="pages" style="display:none;"></select>
    
    <script src="http://connect.facebook.net/en_US/all.js"></script>
    <script>
      FB.init({ appId: 'your app id', status: true, cookie: true, xfbml : true });
    
      function getPages() {  
        FB.login(function(response) {
          if (response.session && response.perms) {
            FB.api('/me/accounts/',  function(response) {
                var pages = document.getElementById('pages');
                pages.style.display = 'block';
                for(var i =0; i < response.data.length; i++)
                {
                  pages[i] = new Option(response.data[i].name);
                }
              }
            );
          }
        } , {perms:'manage_pages'}); 
    }
    </script>
    </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am grabbing data through a jQuery Ajax call, and displaying it on the
I'm grabbing user data from the database using: $stmt = $db->prepare(SELECT usernames FROM login.users
I'm grabbing some database entries, creating a 2D array and then passing them to
I am grabbing all inputs from a 5 tab form. When cyclying through them
I'm grabbing an ISBN from the user. Probably from a barcode scanner (EAN 18
Rather than just grabbing the user's friends' emails, I want to show their list
I am grabbing the last rowid and i am doing this select @@IDENTITY pk
I'm grabbing various jquery objects to put into an array and later spit out
I am grabbing from a MySQL database some fields and putting them into an
I realize the code below is not the most efficient way of grabbing elements,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.