This commit is contained in:
2024-05-03 18:30:28 -05:00
parent 66670bd21e
commit 485efba3b4

View File

@@ -27,8 +27,8 @@
</head> </head>
<body> <body>
<div class="alarm-container"> <div class="alarm-container">
<div id="alarms-container"> <div id="alarms-container-KBIS">
<p>Loading alarms...</p> <p>Loading KBIS alarms...</p>
</div> </div>
</div> </div>
@@ -36,10 +36,10 @@
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script> <script>
$(document).ready(function() { $(document).ready(function() {
// Function to fetch the radar station alarms // Function to fetch the radar station alarms for KBIS
function fetchAlarms(stationId, elementId) { function fetchAlarms_KBIS() {
var apiUrl = "https://api.weather.gov/radar/stations/KMBX/alarms"; var apiUrl = "https://api.weather.gov/radar/stations/KBIS/alarms";
var alarmsElement = $("#" + elementId); var alarmsElement = $("#alarms-container-KBIS");
$.getJSON(apiUrl, function(data) { $.getJSON(apiUrl, function(data) {
alarmsElement.empty(); alarmsElement.empty();
@@ -75,14 +75,15 @@ function fetchAlarms(stationId, elementId) {
}).fail(function() { }).fail(function() {
alarmsElement.text("Failed to fetch alarms."); alarmsElement.text("Failed to fetch alarms.");
}); });
} }
// Call the fetchAlarms_KBIS function initially and then every minute for KBIS
// Call the fetchAlarms function initially and then every minute fetchAlarms_KBIS();
fetchAlarms("KMBX", "alarms-container");
setInterval(function() { setInterval(function() {
fetchAlarms("KMBX", "alarms-container"); fetchAlarms_KBIS();
}, 60000); // 60000 milliseconds = 1 minute }, 60000); // 60000 milliseconds = 1 minute
// You can create a similar function for fetching alarms for KBIS if needed
}); });
</script> </script>
</body> </body>