0
問題是,當我嘗試使用此代碼從tmi.twitch.tv api使用url獲得日誌:http://tmi.twitch.tv/hosts?include_logins=1&target=70219146我得到了Systax錯誤意外令牌。該代碼是:JSON從tmi.twitch.tv api獲取數據的問題api
$(document).ready(function() {
$.getJSON("http://tmi.twitch.tv/hosts?include_logins=1&target=70219146&callback=?", function (data) {
console.log(data.hosts)
});
})
我可以使用PHP和JSON數組像這樣得到的數據:
$json_array = json_decode(file_get_contents('http://tmi.twitch.tv/hosts?include_logins=1&target=70219146'), true);
echo $json_array['hosts']['0']['host_login']."</br>";
但是,這不是有沒有辦法使用HTML做到這一點?謝謝
所以唯一的方法是PHP?該死......反正謝謝! – user3607950