$(document).ready(function () { const createTable = () => { const table = document.getElementById("paymentsTable"); const tbody = table.querySelector("tbody"); // Очищаем таблицу tbody.innerHTML = ""; payments.forEach((payment) => { const row = document.createElement("tr"); row.setAttribute( "onclick", `location.href = '/project/codes/settings/payment/` + payment.id + `'` ); const name = document.createElement("td"); name.textContent = payment.name; row.appendChild(name); const amount = document.createElement("td"); amount.textContent = payment.amount; row.appendChild(amount); const paid = document.createElement("td"); if (payment.paid) { paid.textContent = "Да"; } else { paid.textContent = "Нет"; } row.appendChild(paid); const lastupdate = document.createElement("td"); lastupdate.textContent = payment.lastupdate; row.appendChild(lastupdate); tbody.appendChild(row); }); }; createTable(); });