39 lines
1.1 KiB
PHP
39 lines
1.1 KiB
PHP
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>API Call Example</title>
|
|
<link rel="stylesheet" href="styles.css">
|
|
</head>
|
|
<body>
|
|
|
|
<p id="time"></p>
|
|
<p id="apiData"></p>
|
|
|
|
<div id="content">
|
|
<!-- The data will be displayed here -->
|
|
Loading...
|
|
</div>
|
|
|
|
<script>
|
|
// JavaScript to fetch and display API data every second
|
|
function fetchData() {
|
|
fetch('http://172.17.0.1:5000/status')
|
|
.then(response => response.json())
|
|
.then(data => {
|
|
// Display the fetched data in the div with id 'content'
|
|
document.getElementById('content').innerHTML = JSON.stringify(data, null, 2);
|
|
})
|
|
.catch(error => console.error('Error:', error));
|
|
}
|
|
|
|
// Fetch data on page load
|
|
fetchData();
|
|
|
|
// Set an interval to fetch data every second
|
|
setInterval(fetchData, 1000);
|
|
</script>
|
|
|
|
</body>
|
|
</html> |