0
試圖使用JSON獲取推文。我有推特ID,但沒有任何回報。有任何想法嗎?getJSON Twitter
下面是使用代碼IM
$.getJSON("https://api.twitter.com/1/statuses/show.json?id=204981356940369920", function(data) {
$("#twitter").html(data[0].text);
});
試圖使用JSON獲取推文。我有推特ID,但沒有任何回報。有任何想法嗎?getJSON Twitter
下面是使用代碼IM
$.getJSON("https://api.twitter.com/1/statuses/show.json?id=204981356940369920", function(data) {
$("#twitter").html(data[0].text);
});
這是返回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將
鏈接自動地添加回調到它的網站上?我也會做一個警報(data [0] .text),看看是否有效。 – Keith