Search code examples
jqueryjsonurltwitter

json data not responding to alert


$(document).ready(function () {
    $('form#search').bind("submit", function (e) {
        e.preventDefault();
        $('#content').html('');
        var query1 = urlencode($('input[name="user_a"]').val()); //userA

        $.getJSON('http://twitterank.com/api/get?id=' + query1 + '&devkey=8909d7273e0ab578bde409571747fc9e&callback=?',
            function (data1) {
                alert('JSON data string is: ' + data1.status);
            });
    });
});

this is a code that takes JSON feed from twitterrank.com and displays it on the HTML page.

now the API of twitterank says that the URL http://twitterank.com/api/get?id=Anand_Dasgupta&devkey=8909d7273e0ab578bde409571747fc9e (click to see) will give back the json data...the devkey has been provided by twitterank itself...

but in the code, the alert message doesn't respond when I run


Solution

  • If the alert() never fires, that tells you that the query from twitterank.com is never coming back. I would alert() the query and then try running it from a browser or telnet session to see what's happening.