mvasco mvasco - 2 months ago 6x
Ajax Question

Getting JSON array elements values

I want to show data received from a remote JSON source on a HTML table.

This is part of the script I am using now

var loadData = function(){
var users = JSON.parse(data);
for(var i in users){
$("#content").append("<td>"+users[ i ]+"</td>");

The console shows following output:


On the first td tag appear 1,PMI-M-072 as value.
But I need to show each array element on a td tag.
How can I get each element value?


I think you'll want to do:

var users = JSON.parse(data)["data"];

instead of:

var users = JSON.parse(data);