我有一個json請求的html文件。我無法讓json顯示結果。 我有什麼錯誤?json不顯示結果
<p id="syno"></p>
這就是我應該看到的結果 以下是該
<script>
var apiUrl = 'http://words.bighugelabs.com/apisample.php?v=2&format=json';
$.ajax({
url: apiURL,
type: "GET",
dataType: 'json'});
success: function (response) {
// The request succeeded
console.log(response);
parseWord(response);
},
error: function (xhr, status) {
// The request failed
console.log(status);
showError();
}
function parseWord(data) {
$('#syno').text(noun.ant);
}
</script>
什麼是名詞看看documentation? parseWord叫什麼名字? – ryanlutgen 2014-12-08 02:00:08
複製數據的原始文本格式,並將其保存爲一個'.json'或使用'jQuery.parseJSON(數據)' – Rafael 2014-12-08 02:00:25
名詞是JSON響應 – 2014-12-08 02:01:41