This commit is contained in:
PaulVua
2025-03-25 16:27:01 +01:00
parent 46a8e21e64
commit 76336d0073

View File

@@ -179,21 +179,28 @@ window.onload = function() {
getModem_busy_status(); getModem_busy_status();
setInterval(getModem_busy_status, 2000); setInterval(getModem_busy_status, 2000);
fetch('../config.json') // Replace 'deviceID.txt' with 'config.json' //NEW way to get config (SQLite)
.then(response => response.json()) // Parse response as JSON $.ajax({
.then(data => { url: 'launcher.php?type=get_config_sqlite',
console.log("Getting config file (onload)"); dataType:'json',
//get device ID //dataType: 'json', // Specify that you expect a JSON response
const deviceID = data.deviceID.trim().toUpperCase(); method: 'GET', // Use GET or POST depending on your needs
// document.getElementById('pageTitle_plus_ID').innerText = 'token: ' + deviceID; success: function(response) {
//get device Name console.log("Getting SQLite config table:");
const deviceName = data.deviceName; console.log(response);
//device name_side bar
const elements = document.querySelectorAll('.sideBar_sensorName'); const elements = document.querySelectorAll('.sideBar_sensorName');
elements.forEach((element) => { elements.forEach((element) => {
element.innerText = deviceName; element.innerText = response.deviceName;
}); });
},
error: function(xhr, status, error) {
console.error('AJAX request failed:', status, error);
}
});//end AJAX
//get local RTC //get local RTC
$.ajax({ $.ajax({
@@ -210,9 +217,8 @@ window.onload = function() {
} }
}); });
})
.catch(error => console.error('Error loading config.json:', error)); }//end onload
}
function clear_loopLogs(){ function clear_loopLogs(){