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('' + col + ' ');
}
$table.find('thead').append('' + columns.join('') + ' ');
var rows = [];
for (var i = 0; i < json.length; i++) {
var row = json[i];
var tds = [];
for (var col in row) {
tds.push('' + row + ' ');
}
rows.push('' + tds.join() + ' ');
}
$table.find('tbody').append(rows.join(''));
}
}
7 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Mohan SrinivasPosted May 19, 2017, 9:25 AM
Manas MohapatraPosted May 19, 2017, 9:17 AM
Mohan SrinivasPosted May 19, 2017, 9:06 AM
Mohan SrinivasPosted May 19, 2017, 9:05 AM
Manas MohapatraPosted May 19, 2017, 8:40 AM
Mohan SrinivasPosted May 19, 2017, 8:30 AM
Manas MohapatraPosted May 19, 2017, 8:16 AM