尝试使用JSON获取推文。我有推特ID,但什么也没有返回。有什么想法吗?
下面是im使用的代码:
$.getJSON("https://api.twitter.com/1/statuses/show.json?id=204981356940369920", function(data) {
$("#twitter").html(data[0].text);});
发布于 2012-05-29 00:48:09
这就是返回JSON。由于same-origin security policy的原因,您需要使用JSONP。
因此,调用需要是
https://api.twitter.com/1/statuses/show.json?id=204981356940369920&callback=whatever如果你使用的是jQuery,你可以使用
https://api.twitter.com/1/statuses/show.json?id=204981356940369920&callback=?jQuery会自动添加回调
https://stackoverflow.com/questions/10762430
复制相似问题