smart-green-house-server-an.../html/green_house_settings.html

53 lines
1.4 KiB
HTML
Raw Permalink Normal View History

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>温湿度</title>
</head>
<body>
<div class="tablecenter">
<table id="arpTable" width="700" align="center" border="1" cellspacing="0">
<thead>
<th>温度</th>
<th>湿度</th>
<th>时间</th>
</thead>
<tbody id="greenTableBody" align="center">
</tbody>
</table>
</div>
</body>
<script>
function loadBlackData() {
var blackData;
fetch("../cgi-bin/green_house_info_show.cgi").then(resp => resp.json()).then(data => {
blackData = data;
greenTableBody.innerText = "";
data.forEach(rowData => {
let tr = document.createElement("tr");
let td1 = document.createElement("td");
let td2 = document.createElement("td");
let td3 = document.createElement("td");
td1.innerText = rowData.temperature;
td2.innerText = rowData.humidity;
td3.innerText = rowData.th_date_time;
tr.append(td1, td2, td3);
greenTableBody.append(tr);
});
})
}
window.onload = function () {
loadBlackData();
}
</script>
</html>