Я пытаюсь отобразить базу данных на странице html. Данные появляются в моей консоли, но я не могу понять, как отобразить их в таблице html. Я не уверен, какую функцию мне нужно добавить в console.log (data), чтобы она отображалась на странице. Это то, что я до сих пор:
<button class="btn btn-primary" id="btn">Get Code</button>
<table class="table table-bordered">
<thread>
<tr>
<th>ID</th>
<th>City</th>
<th>Country</th>
<th>Rating</th>
</tr>
</thread>
<tbody id ="tdata">
</tbody>
</table>
<script>
$(function () {
$.getJSON("php.php", {tableName:"travel"}, function(data){
if (data["code"] == "error"){
console.log(data["message"]);
}
else{
console.log(data);
}
console.log("returned hh");
});
});
console.log("returned");
</script>
</body>
</html>