Followers count without authentication


How can I get followers count and total tweets count without authentication?


I was trying to use this:
GET but it doesn’t display anything

Than I’ve tried this one:
function(data) { … });

and even though it displays information when url is paste to browser, but don’t work in this code.
(it also has limit of 150 request per hour)


The /account/totals.json endpoint requires authorization, so you’ll need to pass credentials to access that URL.

It looks like the problem you’re having with the second request is that you’re trying to make a cross-domain request from Javascript. You’ll need to use JSONP for this kind of request. It looks like jQuery supports JSONP by adding the string callback=? to the URL, so the following request should work:

$.getJSON("", function(data) { console.log(data); });


This is true, you need the callback=? in the url string when using $.getJSON method… but why?

Here’s what jQuery API says:

If the URL includes the string “callback=?” (or similar, as defined by the server-side API), the request is treated as JSONP instead. See the discussion of the jsonp data type in $.ajax() for more details.

from source:

I know this is jQuery related, but I think Twitter should openly post this in their API documentation. Something along the lines of “Remember, if your are making the request cross domain make sure to request in JSONP instead of JSON” at the very least. Bonus if they add “for example when using jQuery add callback=? to the URL”.