I have a table that needs to be outputted by data on ajax. But I do not understand how to display this data.

function getTableKredit() { var id; $.ajax({ url: "credit-table.php", cache: false, dataType: "json", success: function(data) { data.forEach(function(item) { document.write("<tr><td style='text-align: left'>" + item.description + "</td><td>" + item.grn + "</td><td>" + item.pln + "</td><td>" + item.eur + "</td><td>" + item.usd + "</td><td><a href='?kredit=1&id=" + item.id + "' class='delete-kredit'>Видалити кредит</a></td></tr>"); }) } }) } 
 <table class="table table-hover table-bordered"> <tr class="info"> <th>Опис</th> <th style="text-align: center;">ГРН</th> <th style="text-align: center;">PLN</th> <th style="text-align: center;">EUR</th> <th style="text-align: center;">USD</th> <th style="text-align: center;">Завешення кредитів</th> </tr> <!-- вивести тут --> <!-- вивести тут --> </table> 

  • Give an example of the data that the Ajax will return - Rostyslav Kuzmovych September
  • @RostyslavKuzmovych yes everything seems to be clear. The only thing that needs to be done is to replace document.write with a la $('table').append($('<tr>....</tr>')) - teran

0