Building HTML table from JSON object via php URL Building HTML table from JSON object via php URL json json

Building HTML table from JSON object via php URL


Assuming that the json you provided is the only output from your json.php you have to slightly change this line:

$.each(data.members, function(i,user){

To this:

$.each(data, function(i,user){


usually in these situations, I add the items to an array and then join and append the array. so for example, in your each.

tblRow = [  '<tr>',    '<td>' + user.fName + '</td>',    '<td>' + user.lName + '</td>',    '<td>' + user.Ext + '</td>',    '<td>' + user.Rm + '</td>',  '</tr>',].join('\n');myArray.push(tblRow);

myArray being an empty array outside of your loop, and then after the loop append the array content to your table.

Hope this helps!