Created
March 25, 2024 18:55
-
-
Save AbhishekGhosh/2c0a488eb1ccf6c4edbf706f00fcb081 to your computer and use it in GitHub Desktop.
index.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Water Tank Level Monitoring</title> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> | |
<script> | |
$(document).ready(function(){ | |
// Function to fetch water level data | |
function fetchWaterLevel() { | |
$.ajax({ | |
url: 'get_data.php', | |
type: 'GET', | |
success: function(data) { | |
// Update water level on the webpage | |
$('#waterLevel').text(data + ' mm'); | |
} | |
}); | |
} | |
// Fetch water level data every 5 seconds | |
setInterval(fetchWaterLevel, 5000); | |
}); | |
</script> | |
</head> | |
<body> | |
<h1>Water Tank Level</h1> | |
<p>Current Water Level: <span id="waterLevel"></span></p> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment