diff --git a/static/js/allmatc.js b/static/js/allmatc.js index c9e2668..bd27654 100644 --- a/static/js/allmatc.js +++ b/static/js/allmatc.js @@ -7,29 +7,30 @@ function getAllData(){ dataType: 'json', success: function(response){ - console.log(response) + console.log("1111") let data = response; - $('#datatable tbody').empty(); - $.each(response, function(index, item) { - $('#datatable tbody').append( - '' + - '' + item.invNumber + '' + - '' + item.nazvanie + '' + - '' + item.raspologenie + '' + - '' + item.numberved + '' + - '' + item.buhnumberpp + '' + - '' + item.kolichestvo + '' + - '' + item.balancenumber + '' + - '' - ); - }) - }, + 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); + }); + + + }, }) } -$(document).ready(function(){ - getAllData() -}) \ No newline at end of file +getAllData() diff --git a/templates/all.html b/templates/all.html index 591890a..62b54bf 100644 --- a/templates/all.html +++ b/templates/all.html @@ -15,7 +15,7 @@
- +
diff --git a/templates/js.html b/templates/js.html index f8d9f27..0892e18 100644 --- a/templates/js.html +++ b/templates/js.html @@ -10,3 +10,4 @@ +
№ п/п