i have a problem with the jquery getjson.
This code works
$.getJSON('http://twitter.com/status/user_timeline/USERNAME.json?count=10&callback=?', function(twitter_data)
{
alert('works');
});
and this code not?
$.getJSON('https://api.twitter.com/1/account/verify_credentials.json?callback=?', function(twitter_data)
{
alert('no alert ?');
});
But why? Any ideas?
example – > http://jsfiddle.net/4wWJW/2/
Thanks in advance!
Peter
I’ve updated a version of your code here: http://jsfiddle.net/4wWJW/9/
Unfortunately the example you give includes a
oauth_noncewhich I believe is a one-time authentication token. So unfortunately this won’t work. You’ll need to be authenticated with your account to debug.Instead of using
jQuery.getJSONI’ve used the long-hand call tojQuery.ajax. This allows an error handler to be used. When the ajax call succeeds thesuccessfunction is called, otherwise theerrorfunction is called.I can see in this case that the call is not successful, e.g. a status code of 200 is not returned, and therefore the
errorfunction is called.You could interrogate the jqXHR object and the other parameters to the error function to see what is happening.