Skip to content

Instantly share code, notes, and snippets.

@AbhishekGhosh
Created March 25, 2024 18:55
Show Gist options
  • Save AbhishekGhosh/2c0a488eb1ccf6c4edbf706f00fcb081 to your computer and use it in GitHub Desktop.
Save AbhishekGhosh/2c0a488eb1ccf6c4edbf706f00fcb081 to your computer and use it in GitHub Desktop.
index.html
<!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