Take the 2-minute tour ×

Why getJSON does not work? This is my HTML:

<h2>Where are my followers</h2>

        <input type="text" id="account"  placeholder="twitter user name"  />
        <input type="button" value="Find Followers" id="button" name="button"  />

<div id="map-canvas" >


and this is my jQuery


alert("Befor JSON");
var url = "http://api.twitter.com/1/statuses/followers/"+document.getElementById('account').value+".json?callback=?";
$.getJSON(url , function (data){
alert(data +"Hi");
alert("after json");


The problem is that alert before json is printed and so is alert after json but alert data+Hi never appears. It is like that getJSON never succeeds.

share|improve this question
what is the error in the browser console –  Arun P Johny Mar 22 '13 at 12:44
seems fine here jsfiddle.net/wbcXC –  Arun P Johny Mar 22 '13 at 12:44
Important: As of jQuery 1.4, if the JSON file contains a syntax error, the request will usually fail silently. Reference –  Bigood Mar 22 '13 at 12:47
why are you concatenating a JSON with a String ? this error is typing! –  Tuyoshi Vinicius Mar 22 '13 at 13:08
Why are you doing this at all? Twitter will be shutting down this part of their old API any day now... –  Zachary Kniebel Mar 22 '13 at 17:55
add comment

2 Answers

try .fail()

$.getJSON(url , function (data){
alert(data +"Hi");
share|improve this answer
It prints Fail !!! what can i do :'( –  user2199085 Mar 22 '13 at 13:01
add comment

I have posted this as an answer to several posts now, and I'm sorry for the repetition, but it seems like there are still a lot of people out of the loop.

Twitter is shutting down their API 1.0, of which this is a part. If you want to make this work, check out my Twitter Feed plugin on GitHub, which will guide you through the steps of making this work. In your case, you will want to change some of the URLs in the sample code, so that you are querying the correct socket, but the code, itself, and the steps for setting this up are the same.

If you are intent on getting the AJAX to work, you can look at the source code for my plugin and it will have the deprecated AJAX commented and marked. However, and I don't mean to yell or sound like a broken record but ANY DAY NOW YOUR AJAX CALL WILL NOT WORK, EVEN IF YOU FIX WHATEVER ERROR YOU HAVE RIGHT NOW.

share|improve this answer
add comment

Your Answer


