Retrieving data

As with Facebook, we could do manual authentication against the OAuth 2.0 endpoint, but let's make use of Google's provided API. Hooking it up is very simple:

document.addEventListener("DOMContentLoaded",
 function() {
    var po = document.createElement('script');
    po.type = 'text/javascript'; po.async = true;
    po.src = 'https://plus.google.com/js/client:plusone.js';
    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(po, s);
  });

This runs once the document is ready and loads the API script from Google's servers by placing a new script tag on the page just before the tag including jQuery. The loaded document contains a number of JavaScript functions that can be used to interact with Google APIs but not specifically ...

Get Data Visualization: Representing Information on Modern Web now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.