Hacker News new | ask | show | jobs
by PanMan 4966 days ago
Why are you going via your server? Couldn't you have the JS get the data from Facebook's Graph API directly?
2 comments

Yep, this page handled entirely client-side, with some analytics JS on top for good measure:

    setInterval(
      function() {
        $.getJSON(
          "https://graph.facebook.com/mittromney",
          function(results) {
            console.log("Mitt Romney Like Count: " + results.likes)})},
      5000)
Edit: Love the idea, glad the page is out there! Great conversation starter.
Haven't tried it, but isn't that blocked by Javascript's cross-domain protection?
jQuery fixes that.
I wasn't expecting this much traffic, so I didn't really care about server performance because it was irrelevant. I only posted it to my Facebook and Twitter, and now it has around 25 likes, I've been twittered by a guy with 4K followers and someone appears to have bloggd me. It's awesome, but very hard to keep it online. I may implement client-side JS in the near future. Thanks for the suggestions!