Is it possible to retrieve a users tweets using a jQuery AJAX request? I have the following code but I’m getting the same origin error.
function GetTweets(handle) {
$.ajax({
url: "https://api.twitter.com/1/statuses/user_timeline.xml?screen_name=wesleyskeen"
}).success(function (tweets) {
console.log(tweets)
});
}
Even when I add
dataType: "jsonp"
I get a different error
Uncaught SyntaxError: Unexpected token <
The results are actually returned, but they are returned in XML as it seems to be giving the script a problem.
Any help on this would be much appreciated.
You are requesting XML. Uso the json url instead:
https://api.twitter.com/1/statuses/user_timeline.json?screen_name=wesleyskeen
(Simply change xml in your url path to json)