I've been experimenting with different versions of the code below in order to populate an HTML table with JSON data. I've simplified the API response to just 1 result. The JSON data appears to be deeply nested, and I'm struggling to parse and display it correctly. Any suggestions on what I might be doing wrong? Initially, I only want to show the "name".
Here is the response:
{"list":[{"id":31,"name":".Scala_Test_Player 0696GS (RMS09061606)","uuid":"a363ef6c-4ea0-4835-bd98-03b27e9139fc",(...)}
HTML:
<table>
<tbody id="scalaapi">
<tr><td></td></tr>
</tbody>
</table>
Script:
function jsonData()
{
$.ajax({
type:'GET',
url:"https://avacmd25.scala.com:44335/ContentManager/api/rest/players?limit=1&offset=0&sort=name",
datatype:'json',
success:function(data)
{
var jdata=$.parseJSON(data);
$(function(){
$.each(jdata,function(i,item){
var tr = $('<tr>').append(
$('<td>').text(list.name),
$("#scalaapi tbody").append(tr));
})
})
}
})
}