javascript - JQuery get value out of json by key -
i generate json looks this:
{ "attendees": [ { "datum": "tue, 11 apr 2017 00:00:00 gmt", "name": " muylaert-geleir", "prename": "alexander" }, { "datum": "wed, 12 apr 2017 00:00:00 gmt", "name": " obolina", "prename": "angelina" }, { "datum": "thu, 13 apr 2017 00:00:00 gmt", "name": " obolina", "prename": "angelina" }, ] }
how value keys , place tables? got...
$.ajax(settings).done(function (response) { (i = 0; < response.attendees.length; i++){ console.log(i); $('tbody').append('<tr><td>'+ response.attendees["name"] + '</td><td>'+ response.attendees["prename"] + '</td><td>' + response.attendees["datum"] + '</td></tr>'); console.log(response.attendees["name"]); } });
you there, use response.attendees[i]
getting individual properties instead of response.attendees
$('tbody').append('<tr><td>'+ response.attendees[i]["name"] + '</td><td>'+ response.attendees[i]["prename"] + '</td><td>' + response.attendees[i]["datum"] + '</td></tr>');
Comments
Post a Comment