我有一个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