update
This commit is contained in:
@@ -179,40 +179,46 @@ 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);
|
||||||
|
|
||||||
const elements = document.querySelectorAll('.sideBar_sensorName');
|
//device name_side bar
|
||||||
elements.forEach((element) => {
|
const elements = document.querySelectorAll('.sideBar_sensorName');
|
||||||
element.innerText = deviceName;
|
elements.forEach((element) => {
|
||||||
});
|
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({
|
||||||
url: 'launcher.php?type=RTC_time',
|
url: 'launcher.php?type=RTC_time',
|
||||||
dataType: 'text', // Specify that you expect a JSON response
|
dataType: 'text', // Specify that you expect a JSON response
|
||||||
method: 'GET', // Use GET or POST depending on your needs
|
method: 'GET', // Use GET or POST depending on your needs
|
||||||
success: function(response) {
|
success: function(response) {
|
||||||
console.log("Local RTC: " + response);
|
console.log("Local RTC: " + response);
|
||||||
const RTC_Element = document.getElementById("RTC_time");
|
const RTC_Element = document.getElementById("RTC_time");
|
||||||
RTC_Element.textContent = response;
|
RTC_Element.textContent = response;
|
||||||
},
|
},
|
||||||
error: function(xhr, status, error) {
|
error: function(xhr, status, error) {
|
||||||
console.error('AJAX request failed:', status, error);
|
console.error('AJAX request failed:', status, error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
})
|
|
||||||
.catch(error => console.error('Error loading config.json:', error));
|
}//end onload
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function clear_loopLogs(){
|
function clear_loopLogs(){
|
||||||
|
|||||||
Reference in New Issue
Block a user