I am looking for a headstart to implement a custom tweet-counter for my Rails app.
Using tweet button gives me the option to either use the twitter-syled button+counter, or use a custom link, without counter.
What I’d like to achievem is to add a counter to a simple <a href="http://convoluted?tweet=url">tweet this</a> url.
e.g. tweet this → jQuery → tweeted 123 times, tweet this
For that, I need to simply parse the Json from http://urls.api.twitter.com/1/urls/count.json?url=http://example.com&callback=twttr.receiveCount and update the DOM with that counter.
My jQuery is poor and rusty, so I’d love to find a headstart with some example code to go by. Any hints? Or existing libraries? Or projects where I can look into the code that have this covered?
you need to make a jsonp request.
There is a blog post that talks about it here:
http://jquery-howto.blogspot.com/2009/04/twitter-jsonjsonp-api-url.html
also, this probably does exactly what you need:
http://www.w3avenue.com/2010/02/24/how-to-get-digg-delicious-and-tweet-counts-using-jquery/