$(function(){
$.ajax({
url:'http://api.twitter.com/1/statuses/user_timeline.json?screen_name=user_name&callback=?',
//dataType:'json',
success:function(data){$('body').append('the data is' +data);}
});
});
the above code with dataType line prints out [objects] while with the dataType line commented it prints out nothing …how can i get it to print the json output from the server rather then the javascript object?
First, you may want to check out Twitter’s API docs, it has all this broken down with descriptions, here’s the direct link to
user_timeline.Alternatively, here’s the manual route 🙂
To inspect it you have a few options, if you’re using Firefox/Firebug or Chrome, you can log it to the console, like this:
Another option is just visiting the URL: http://api.twitter.com/1/statuses/user_timeline.json?screen_name=user_name&callback= Then take the result and pop it in something like JSONLint to format it for easier browsing.
What you’ll probably end up wanting is something like this: