this script generates 4 jquery ui tabs with 4 html tables inside it,
how do i combine these tables to make it in a single table, attached a screenshot of final table.
var data = $.parseJSON("{\"version\":\"5.2\",\"user_type\":\"online\",\"user\":[{\"name\":\"John\",\"id\":50},{\"name\":\"John\",\"id\":51},{\"name\":\"John\",\"id\":57},{\"name\":\"John\",\"id\":98}]}");
const setTables = new Set();
$.each(data.user, function(key, value) {
let table;
var row = $("<tr/>");
if ($('table#main_table_' + value.id).length)
table = $("#main_table_" + value.id);
else
table = $('<table class="table table-responsive table-hover table-bordered"></table>');
table.attr('id', 'main_table_' + value.id);
row.append($("<td/>").text(value.name));
row.append($("<td/>").text(value.id));
table.append(row);
if(!setTables.has(value.id)) {
table.append( $("<thead><tr><th>NAME</th><th>ID</th></tr></thead>") );
setTables.add(value.id);
$( "#ul-tabs" ).append("<li><a href=\"#tabs-"+ value.id +"\">"+value.name+"</a></li>");
$( "#tabs" ).append("<div id=\"tabs-"+value.id+"\">"+table.prop('outerHTML')+"</div>");
}
});
$( "#tabs" ).tabs();
