So I have a pretty long (nested) JSON array (I've minified it):
{
"items" : [ {
"track" : {
"album" : {
"name" : "Pressure Makes Diamonds"
},
"artists" : [ {
"name" : "Danny Vera"
} ],
"href" : "https://api.spotify.com/v1/tracks/7rO7Pc5dkC2EIW1OKsCJtQ",
"name" : "Roller Coaster"
}
}, {
"track" : {
"album" : {
"name" : "Amigo"
},
"artists" : [ {
"name" : "Chef'Special"
} ],
"href" : "https://api.spotify.com/v1/tracks/6yvxKrf9KZLTodXFTBmdR1",
"name" : "Nicotine"
}
}, {
"track" : {
"album" : {
"name" : "Lines (New Version)"
},
"artists" : [ {
"name" : "Niels Geusebroek"
} ],
"href" : "https://api.spotify.com/v1/tracks/62En58kZelNGnGvmJUMVC0",
"name" : "Take Your Time Girl (live at ruud de wild/538)"
}
} ]
}
and I'm trying to display it in a Datatable with this code:
<script>
$(document).ready(function() {
$('#table_id').DataTable( {
processing: true,
data: {!! $response !!}, // <= this is where the JSON comes from (Laravel)
columns: [
{ "track" : "name" },
{ "track" : "album.name" },
{ "track" : "artists[0].name" }
]
})
})
</script>
Anyone got any idea what I'm doing wrong?
I looked up the Datatables (Datatables) and followed it, but it still doesn't work...
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…