I am fetching the JSON file from local in the table, i just want to add the button in last of each row. How can i do this? I was trying but fail to add button in the last position. 2-fedtest.json is my local file that i read the JSON file and show all the data in the table.
Code
function check_user_online() {
var logged_in_user = {};
logged_in_user = JSON.parse(localStorage.getItem('current_login_user')); //get data from storage
// alert(logged_in_user.img);
if (logged_in_user == undefined) {
window.location.href = 'login.html';
} else {
var profile_image = logged_in_user.image;
var email = logged_in_user.email;
// var user_email = logged_in_user.email;
document.getElementById('dashboard_image').src = profile_image;
document.getElementById('Username').innerHTML = 'Welcome, ' + email;
var myInit = {
method: 'GET',
headers: {
'Content-Type': 'application/json'
},
mode: 'cors',
cache: 'default'
};
let myRequest = new Request("2-fedtest.json", myInit);
fetch(myRequest)
.then(function(resp) {
return resp.json();
})
.then(function(data) {
console.log(data.listing_data);
// alert(JSON.stringify(data.listing_data));
response(data.listing_data);
})
function response(e) {
let table = document.getElementById("transaction_table");
let row, cell, button;
for (let i = 0; i < e.length; i++) {
row = table.insertRow();
cell = row.insertCell();
cell.textContent = e[i].request_id;
cell = row.insertCell();
cell.textContent = e[i].document_last_name;
cell = row.insertCell();
cell.textContent = e[i].email;
cell = row.insertCell();
cell.textContent = e[i].document_dob;
cell = row.insertCell();
cell.textContent = e[i].used_services_in_request;
cell = row.insertCell();
cell.textContent = e[i].country_name;
cell = row.insertCell();
cell.textContent = e[i].reference;
cell = row.insertCell();
cell.textContent = e[i].created_at;
cell = row.insertCell();
cell.textContent = e[i].verification_status;
}
}
return true;
}
}