jQueryでJSONファイルを解析しようとしています。新しいカテゴリ (最初の文字を除く) の各 image_url を返し、ページに画像を配置したいと考えています。
これが私のコードです
function redo () {
$('#init').addClass('disabled');
$.getJSON('http://server/new/sample.json', function(data) {
$.each(data.products_and_categories.new, function(item){
$("<img/>").attr("src", "http://d2flb1n945r21v.cloudfront.net/production/uploaded/style/" + item.image_url.substring(1)).appendTo("#items");
});
});
$('#init').removeClass('disabled');
};
そして、クロムインスペクターでこのエラーを返します
Uncaught TypeError: Cannot call method 'substring' of undefined
なぜ未定義なのですか?