By default, jQuery executes an AJAX request. Since this is a cross-domain and the CORS HTTP header is not in response, it fails. Add & callback =? request url to make jsonp request
var pageURL = "http://www.google.com"; var urlParams = $.param({ "url": pageURL }); var tweet = "https://cdn.api.twitter.com/1/urls/count.json?"+urlParams; $.ajax(tweet, { "dataType" :"jsonp" }).done(function(json){ $('#twitterfeed').text(json.count); });
Demo
http://jsbin.com/tasaloraje/edit?html,output
source share