JSONJSON - 获取值
{
"items":
[
{
"name": "Project title",
"id": 16,
"image": "\u002fimages\u002fdefault.png",
},
{
"name": "Project title",
"id": 25,
"image": "\xxx",
},
]
}
JQquery
var getDataUrl = '/data';
$.ajax({
url: getDataUrl,
type: 'GET',
dataType: 'json',
success: function(response){
console.log(response + 'get?');
$.each(response, function() {
console.log(response.name + 'get?');
});
},
error: function(error) {
console.log(error)
}
});
试图让响应值打印,但不知道为什么它不显示名称。我需要获取名称,ID和图像,但现在测试,看看是否显示名称...
帮助赞赏,谢谢。
它CONSOLE.LOG之前(response.name +'进去呢?);哈哈你已经改变了。总而言之+1 – Bhadra
@Bhadra哈哈,我忘了擦除console.log – kittymeows