를 사용하여 JSON 개체 찾아보기 : 나는 각 JQuery와 확인 오류이나는 다음과 같이 하나의 JSON 개체를 구축해야 JQuery와
// here i access to all the $t['w'][$id]
$.each(data.w, function(k,v){
var that=this;
doSomething();
// now i want to access to all the $t['w'][$id]['c']
$.each(that.c, function(k1,v1){
doSomething();
});
});
처럼하지만, 여기에 두 번째에서 객체를 검색
<?
$t['w'][$id]['marchin']=$machin;
$t['w'][$id]['c'][$id_com]['machin']=$machin;
echo json_encode($t);
?>
을 .. $ t [ 'w'] [$ id] [ 'c'] 모두 액세스하는 방법 ?!
당신을 감사좋아, 내가 시도 : 여기
내 JSON의 예 $.each(data.w, function(k,v){
var that = $.parseJSON(this);
doSomething();
$.each(that[k]['c'], function(k1,v1){
doSomething();
});
});
하지만 다시 작동하지 않습니다,
{"w":
{"3":
{"test":"test","c":
{"15":
{"test2":"test2"}
}
}
}
}
당신은 JSON을 게시 마음을 주시겠습니까? – Stphane
json 문자열을 'var myObj = $ .parseJSON (data);'로 다시 구문 분석 했습니까? – adeneo