Files
asuinventory/static/js/allmatc.js
2024-04-03 22:50:16 +03:00

37 lines
965 B
JavaScript

function getAllData(){
$.ajax({
url: "/getall",
type: "get",
contentType: 'application/json',
dataType: 'json',
success: function(response){
console.log("1111")
let data = response;
var table = document.getElementById('alldatable');
var tbody = table.getElementsByTagName('tbody')[0];
// Clear existing data
tbody.innerHTML = '';
// Loop through the data and create table rows
data.forEach(function(item) {
var row = document.createElement('tr');
Object.values(item).forEach(function(value) {
var cell = document.createElement('td');
cell.textContent = value;
row.appendChild(cell);
});
tbody.appendChild(row);
});
},
})
}
getAllData()