Forums - C# Corner

Forum guidelines
Mohan Srinivas

Mohan Srinivas

  • 1.4k
  • 63
  • 1.5k

table displaying [object Object] in every cell

May 19 2017 6:50 AM
based on drop down i m displaying table using ajax jquery call.while i m selecting drop down list table is displaying but every cells showing [object Object] instead of data's
 
This my jquery code: 
 
function generateTable(json) {
var $table = $('#tblDynamic');
$table.find('thead').empty()
$table.find('tbody').empty()
if (json && json.length > 0) {
var header = json[0];
var columns = [];
for (var col in header) {
columns.push('<th>' + col + '</th>');
}
$table.find('thead').append('<tr>' + columns.join('') + '</tr>');
var rows = [];
for (var i = 0; i < json.length; i++) {
var row = json[i];
var tds = [];
for (var col in row) {
tds.push('<td>' + row + '</td>');
}
rows.push('<tr>' + tds.join() + '</tr>');
}
$table.find('tbody').append(rows.join(''));
}
}
 

Answers (7)

File APIs for .NET
Aspose are the market leader of .NET APIs for file business formats – natively work with DOCX, XLSX, PPT, PDF, MSG, MPP, images formats and many more!