Does anybody know how http://mashable.com put up a slick social widget that counts the number of total shares from different social networking sites? I just want to know if you can do this by jQuery.
Asked
Active
Viewed 680 times
1 Answers
0
You can also make individual request to each api (via PHP, as Google and Twitter do not allow Cross Domain) - create a wrapper class call, this will calculate individual counts over you server.
Similar Implementation (php) - http://www.saladappstore.com/page/social-analytics
To use jQuery - http://jsfiddle.net/sanchit_gupta/f9kqm/
(function() {
var url = "http://www.cnn.com";
$.getJSON('http://api.sharedcount.com/?url=' + url, function(data){
$('body').append('<p></p>Google Plus ' + JSON.stringify(data['GooglePlusOne']));
$('body').append('<p></p>Twitter ' + JSON.stringify(data['Twitter']));
$('body').append('<p></p>Facebook ' + JSON.stringify(data['Facebook']['total_count']));
});
})();

Taylan Aydinli
- 4,333
- 15
- 39
- 33