This commit is contained in:
PaulVua
2025-01-09 22:30:58 +01:00
parent dda794dae4
commit 73e6883cf5
6 changed files with 198 additions and 4 deletions

View File

@@ -110,6 +110,34 @@
.catch(error => console.error(`Error loading ${file}:`, error));
});
});
window.onload = function() {
fetch('../config.json') // Replace 'deviceID.txt' with 'config.json'
.then(response => response.json()) // Parse response as JSON
.then(data => {
console.log("Getting config file (onload)");
//get device ID
const deviceID = data.deviceID.trim().toUpperCase();
document.getElementById('pageTitle_plus_ID').innerText = 'token: ' + deviceID;
//get local RTC
$.ajax({
url: 'launcher.php?type=RTC_time',
dataType: 'text', // Specify that you expect a JSON response
method: 'GET', // Use GET or POST depending on your needs
success: function(response) {
console.log("Local RTC: " + response);
const RTC_Element = document.getElementById("RTC_time");
RTC_Element.textContent = response;
},
error: function(xhr, status, error) {
console.error('AJAX request failed:', status, error);
}
});
})
.catch(error => console.error('Error loading config.json:', error));
}
</script>
</body>