JSFiddle - React, Tailwind, and code Playground
by Arif Hasan
JavaScript
var data = [{
"UserID": 1,
"UserName": "rooter",
"Password": "12345",
"Country": "UK",
"Email": "[email protected]"
},
{
"UserID": 2,
"UserName": "binu",
"Password": "123",
"Country": "uk",
"Email": "[email protected]"
},
{
"UserID": 3,
"UserName": "cal",
"Password": "123",
"Country": "uk",
"Email": "[email protected]"
},
{
"UserID": 4,
"UserName": "nera",
"Password": "1234",
"Country": "uk",
"Email": "[email protected]"
}
];
var titles = ["Name", "Group Link", "Request Date", "Question 1", "Question 2", "Question 3"];
var datas = ["Arif", "787454", "2 January", "What?", "Ok", "Tf"];
$(document).ready(function() {
var html = '<table class="table table-striped">';
html += '<tr>';
var flag = 0;
$.each(titles, function(index, value) {
//console.log(value);
});
$.each(data[0], function(index, value) {
// console.log(index);
html += '<th>' + index + '</th>';
});
html += '</tr>';
$.each(data, function(index, value) {
//console.log(index);
console.log(value);
html += '<tr>';
$.each(value, function(index2, value2) {
// console.log(index2);
console.log(value2);
html += '<td>' + value2 + '</td>';
});
html += '<tr>';
});
html += '</table>';
$('body').html(html);
});