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