「jQuery入門」jsonデータを読み込むサンプル

JSコード:
$(function() {
var json = ‘[{“id”:”1″,”tagName”:”data1″},
{“id”:”2″,”tagName”:”data2″},
{“id”:”3″,”tagName”:”data3″},
{“id”:”4″,”tagName”:”data4″},
{“id”:”5″,”tagName”:”data5″}]’;
$.each(JSON.parse(json), function(idx, obj) {
console.log(idx+”***”+obj.tagName);
});
});

Comments are closed.