Updated double load
This commit is contained in:
11
alerts.html
11
alerts.html
@@ -37,8 +37,8 @@
|
|||||||
<script>
|
<script>
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
// Function to fetch the radar station alarms
|
// Function to fetch the radar station alarms
|
||||||
function fetchAlarms(stationId, elementId) {
|
function fetchAlarms(stationId, elementId) {
|
||||||
var apiUrl = "https://api.weather.gov/radar/stations/" + stationId + "/alarms";
|
var apiUrl = "https://api.weather.gov/radar/stations/KMBX/alarms";
|
||||||
var alarmsElement = $("#" + elementId);
|
var alarmsElement = $("#" + elementId);
|
||||||
|
|
||||||
$.getJSON(apiUrl, function(data) {
|
$.getJSON(apiUrl, function(data) {
|
||||||
@@ -75,12 +75,13 @@
|
|||||||
}).fail(function() {
|
}).fail(function() {
|
||||||
alarmsElement.text("Failed to fetch alarms.");
|
alarmsElement.text("Failed to fetch alarms.");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Call the fetchAlarms function initially and then every minute
|
// Call the fetchAlarms function initially and then every minute
|
||||||
fetchAlarms("KBIS", "alarms-container");
|
fetchAlarms("KMBX", "alarms-container");
|
||||||
setInterval(function() {
|
setInterval(function() {
|
||||||
fetchAlarms("KBIS", "alarms-container");
|
fetchAlarms("KMBX", "alarms-container");
|
||||||
}, 60000); // 60000 milliseconds = 1 minute
|
}, 60000); // 60000 milliseconds = 1 minute
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user