jQuery-Trying to emulate a simple Facebook info and feed page through Facebook Graph API

Im trying to emulate a simple page which includes facebook info like username, email etc. I’m not able to obtain the user’s posts from the json received. Tried various methods like making the feed a different function but all failed. Please help.

$(document).ready(function() {
  var fbtoken = 'your token here';

  function getInfo() {

    $.ajax('https://graph.facebook.com/me?access_token=' + fbtoken, {

        success: function(response) {
          console.log(response);
          console.log(typeof(response));
          $("#Id").html('<a target="blank" href="https://facebook.com/' + response.id + '">https://facebook.com/' + response.id + '</a>');
          $('#name').text(response.name);
          $('#about').text(response.about);
          $('#birthday').text(response.birthday);
          $("#email").text(response.email);
          $("#feed").text(response.posts.data);



        }

      }

    );
  }

  $("#load").on('click', getInfo)
});
<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width,initial-scale=1.0">
  https://code.jquery.com/jquery-3.2.1.min.js
  http://FacebookPro.js
  <title>Facebook Mockup</title>
</head>

<body>
  

My Facebook Mockup

Run

Id

Name

About

Birthday

Email

</div> <h2 align="center">Feed</h2>

FB Feed=

</div> </div> </body> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> </html>

You can insert your token in the fbToken variable using Graph API Explorer in Tools And Support. I think i'm making a mistake in retrieving the data part as it is an object-of-array but i'm having a hard time figuring out how to do it right.

Source: stackoverflow-javascript

Can I call fbq(‘init’) multiple times to use new pixel feature?

I want to use the new Facebook Ads Pixel feature where I can pass through my own information about a viewer when they’re unmatched to the Facebook cookie.

However, I want to do this on a checkout page, which has fields for the user to enter in their name, address etc. They do this after the page has loaded, of course.

I can pull the information from the fields as the customer types, or once the person clicks on the buy button. However, is there going to be a problem running the fbq('init'...) function more than once? I’m assuming that if I don’t include the init function straight away, it won’t work with my standard event tracking (to track a page view etc), so I don’t really want to delay it until they click on the button as I’ll lose that other metric.

Alternatively, I could do this after they’ve provided their information on the next page that they see.

My questions ends up as; is there a problem calling fbq('init'...) more than once on a single page and will it work to send through that extra details about the customer if I do so?


Source: stackoverflow-javascript