0
jQuery를 사용하여 JSON 파일의 데이터를 구문 분석하고 표시하고 있습니다. 브라우저에서 침을 뱉어 낼 수있는 모든 것이 있지만 JSON 파일의 키 중 하나에 값 배열이 있습니다. 여기 내 jQuery 코드입니다jQuery를 사용하여 배열로 JSON 객체를 표시하는 방법
{
"category" : "Stuff",
"location_id" : {
"longitude" : "-71.89237903999964",
"latitude" : "41.6809076720005",
"human_address" : "{\"address\":\"156 Plainfield Pike Rd\",\"city\":\"Plainfield\",\"state\":\"CT\",\"zip\":\"06374\"}"
},
}
과 : 그래서 예를 들어이 내 JSON 인 location_id의 출력으로 나오면 어떤 이유로
$.getJSON('data.json', function(data) {
var output = '<ul class="searchresults">';
$.each(data, function(key, val) {
if (val.item.search(myExp) != -1) {
output += '<li>';
output += '<p>' + "Category: " + val.category + '</p>';
output += '<p>' + "Location: " + val.location_id + '</p>';
output += '<p>' + "Business: " + val.business + '</p>';
output += '</li>';
}
});
output += '</ul>';
$('#update').html(output);
나는 [개체, 개체] ... 수 누군가 내가 그 배열에있는 모든 것을 갖도록 도울까요?
감사합니다.