jquery를 사용하여 json 객체를 구문 분석하려고하지만 null 객체의 길이를 가져올 수 없다는 오류가 발생합니다. 이유를 찾을 수 없습니다. 문제를 찾는데 도와주세요. 여기에 내가하고있는 일이있다jQuery를 사용하여 JSON 객체 구문 분석
var slider_images = {
"image": [
{"fname":"1", "caption":"this is 1"},
{"fname":"2", "caption":"this is 2"},
{"fname":"3", "caption":"this is 3"},
{"fname":"4", "caption":"this is 4"},
{"fname":"5", "caption":"this is 5"},
{"fname":"6", "caption":"this is 6"},
{"fname":"7", "caption":"this is 7"},
{"fname":"8", "caption":"this is 8"}
]
};
var imageObj = $.parseJSON(slider_images.image);
$.each(imageObj,function() {
//alert("fname is::"+this['fname']);
alert("1");
});
나는 이미지 아래에있는 모든 하위 객체에 대해 fname과 캡션을 얻고 싶다. 내가 어디로 잘못 가고 있는지 알려주세요.
고마워요!
@Don는 : 작동하지 않습니다 .... 앤드류는 –