抱歉,我是新手,不知道如何正确执行此操作。我想从中提取数据:
{
"list": [
{ "brewery":"Strangeways", "beer":"Albino Monkey" },
{ "brewery":"St. Bernardus", "beer":"Pater 6" }
]
}
这就是我想出的
$(document).ready(function(){
$.getJSON('http://example.com/api/temp/66', function(data) {
var brewery=[];
brewery[0]=data.list[0].brewery[1];
var newHTML = [];
$.each(brewery, function(index, value) {
newHTML.push('<span>' + value + '</span>');
});
$(".element").html(newHTML.join(""));
});
});