问题描述
解决
现在的问题是,Twitter的现在(愚蠢)需要的OAuth即使是公开的数据。一个很容易的解决办法是有一个本地的PHP脚本OAuths和获取数据和访问,与阿贾克斯,而不是Ajaxing直接叽叽喳喳。
目前,我试图从使用Reqwest JavaScript库的Twitter用户拉时间表。然而,当我这样做的请求被认为是成功的,但没有数据被检索到,并在控制台显示出现错误。在code我尝试如下:
$。domready中(函数(){
$阿贾克斯({
网址:http://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=twitter,
类型:JSONP,
成功:函数(响应){
的console.log(响应);
},
错误:函数(ERR){
执行console.log(ERR);
}
});
})
我刚刚更新一个插件我的与Twitter的API 1.1的工作。不幸的是,每Twitter的催促下,你将不得不执行从服务器端code中的实际要求。但是,您可以通过响应插件,它会采取其他的事情。我不知道你正在运行的框架,但我已经添加了样品code制作在C#中的要求,将增加样本code为PHP,不久。
Solved
The problem is that Twitter now (stupidly) requires OAuth even for public data. An easy enough workaround is to have a local php script which OAuths and gets the data and access that with Ajax as opposed to Ajaxing twitter directly.
$.domReady(function () {
$.ajax({
url: 'http://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=twitter',
type: 'jsonp',
success: function (response) {
console.log(response);
},
error: function (err) {
console.log(err);
}
});
})
I just updated a plugin of mine to work with the Twitter 1.1 API. Unfortunately, per Twitter's urging, you will have to perform the actual request from server-side code. However, you can pass the response to the plugin and it will take care of the rest. I don't know what framework you are running, but I have already added sample code for making the request in C#, and will be adding sample code for PHP, shortly.
这篇关于Twitter的user_timeline JSONP。没有反应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!