all working i think
This commit is contained in:
39
archive/index.php.old
Normal file
39
archive/index.php.old
Normal file
@ -0,0 +1,39 @@
|
||||
<!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>
|
||||
Reference in New Issue
Block a user