title: Getting Counts for Twitter links, Facebook likes and Google +1 with Jquery and AJAX
body: <p>i am trying to get the counts for twitter, facebook and google with jquery.getJSON requests starting from the great <a href="http://johndyer.name/getting-counts-for-twitter-links-facebook-likesshares-and-google-1-plusones-in-c-or-php/" rel="nofollow">guide by John Dyer</a> on how do the same with C# and PHP</p>
  
  <p>actually twitter and facebook works but google don't... the json response is:</p>
  
  <pre><code>{
    "error": {
    "code": 400,
    "message": "Required value: id",
    "data": [
     {
      "domain": "global",
      "reason": "required",
      "message": "Required value: id"
     }
    ]
   },
   "id": "p"
  }
  </code></pre>
  
  <p>here is the code:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
    function getfbcount(url){
       var fblikes;
       $.getJSON('http://graph.facebook.com/?ids=' + url, function(data){;
          fblikes = data[url].shares;
          $('body').append('fb likes ' + fblikes);
       });
    }
    function gettwcount(url){
       var tweets;
       $.getJSON('http://urls.api.twitter.com/1/urls/count.json?url=' + url + '&amp;callback=?', function(data){
          tweets = data.count;
          $('body').append('tweets ' + tweets);
       });
    }
    function getplusone(url){
       var plusones;
       $.getJSON('https://clients6.google.com/rpc?key=AIzaSyCKSbrvQasunBoV16zDH9R33D88CeLr9gQ' + 'callback=?',
          {
             "method":"pos.plusones.get",
             "id":"p",
             "params":{
                "nolog":true,
                "id":url,
                "source":"widget",
                "userId":"@viewer",
                "groupId":"@self"
             },
             "jsonrpc":"2.0",
             "key":"p",
             "apiVersion":"v1"
          },
          function(data){           
          plusones = data.count;
          $('body').append('+1 ' + plusones);
       });
    }
    $(document).ready(function($){
          var url = "http://www.google.com"
          getfbcount(url);
          gettwcount(url);
          getplusone(url);
    });
    &lt;/script&gt;
  </code></pre>