次の JSON データ文字列を jquery にループするにはどうすればよいですか? 関数 $.getJSON を使用する必要がありますか?
jQuery17209521235961001366_1380903443191({"type":"result","rid":"hopkinsa","data":
[[{"artist":"NAME1","title":"SONG1","album":null,"royaltytrackid":null,"url":null,"image":"test1.jpg","time":1380910069,"localtime":"11:07 AM"},
{"artist":"NAME2","title":"SONG2","album":null,"royaltytrackid":null,"url":null,"image":"test2.jpg","time":1380909866,"localtime":"11:04 AM"},
{"artist":"NAME2","title":"SONG3","album":null,"royaltytrackid":null,"url":null,"image":"test3.jpg","time":1380909864,"localtime":"11:04 AM"}],false,0,10,0]})
私はこのコードで試しています:
$(document).ready(function() {
$.getJSON("json.php", function(data){
$.each(data.data[0], function(i, item){
$("#data").append(item.artist); // Name1, Name2
});
})
});