I am writing an script to get my twitter json data. I did everything correctly and got bearer token form hurl.it. But it is producing error when I am using that bearer token to get twitter data. What is wrong with my code. It is throughing the following error.
{"readyState":0,"responseText":"","status":0,"statusText":"error"}
My code is:
$(function(){
$.ajax({
type: 'GET',
url: 'https://api.twitter.com/1.1/users/show.json?screen_name=menightfury',
headers: {
'Authorization': 'Bearer AAAAAAAAAAAAAAAAAAAAAGEkywAAAAAA%2F81O13D%2B6ZDrS%2FMfOBYOBKrBygg%3DBEMX87IsIhpgH677fGhH7BcARa6XwnZHpal94fYcTo3thsbWRO'
},
success: function(data){
$('body').append(JSON.stringify(data));
},
error: function(err){
$('body').append(JSON.stringify(err));
}
});
});