What's wrong with this jquery ajax call to the twitter api?


#1

Hello - What’s wrong with the following jQuery ajax call to the Twitter API?:

$(function () {
$.ajax({
url: ‘https://api.twitter.com/1.1/statuses/user_timeline.json’,
data: ‘count=2&screen_name=rickygervais’,
//crossDomain: true,
//beforeSend: setRequestHeader,
success: function(result){ alert(‘success’); },
error: ajaxError
});
});

I have this request executing successfully through Fiddler. Do I need to set the crossDomain ajax setting for this? My beforeSend is just setting xhr.setRequestHeader(‘Authorization’, ‘token val here’). I’m not getting any meaningful error information from this call…


#2

set dataType: “jsonp” in the $.ajax options


#3

Please suggest me to get twitter data through jquery