mirror of
https://github.com/richonguzman/LoRa_APRS_iGate.git
synced 2026-04-07 15:36:24 +00:00
test html
This commit is contained in:
parent
2832fad88a
commit
93ada6a7cd
7 changed files with 24 additions and 2198 deletions
|
|
@ -3,22 +3,32 @@ fetch('igate_conf.json')
|
|||
.then(response => response.json())
|
||||
.then(data => {
|
||||
// Process the JSON data
|
||||
displayJSONData(data);
|
||||
//displayJSONData(data);
|
||||
|
||||
const jsonDataDiv = document.getElementById('json-container');
|
||||
jsonDataDiv.innerHTML = ''; // Clear the previous content
|
||||
|
||||
if (Array.isArray(data)) {
|
||||
// If data is an array, iterate through it
|
||||
data.forEach(item => {
|
||||
const itemDiv = document.createElement('div');
|
||||
itemDiv.textContent = JSON.stringify(item, null, 2);
|
||||
jsonDataDiv.appendChild(itemDiv);
|
||||
});
|
||||
} else {
|
||||
// If data is not an array, display it directly
|
||||
const itemDiv = document.createElement('div');
|
||||
itemDiv.textContent = JSON.stringify(data, null, 2);
|
||||
jsonDataDiv.appendChild(itemDiv);
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error fetching JSON:', error);
|
||||
console.error('There was a problem fetching the JSON data:', error);
|
||||
});
|
||||
|
||||
// Display JSON data in the HTML
|
||||
function displayJSONData(data) {
|
||||
const jsonContainer = document.getElementById('json-container');
|
||||
/*jsonContainer.innerHTML = '';
|
||||
|
||||
data.forEach(item => {
|
||||
const itemDiv = document.createElement('div');
|
||||
itemDiv.textContent = JSON.stringify(item, null, 2);
|
||||
jsonContainer.appendChild(itemDiv);
|
||||
});*/
|
||||
|
||||
jsonContainer.innerHTML = JSON.stringify(data, null, 2);
|
||||
//const jsonContainer = document.getElementById('json-container');
|
||||
//jsonContainer.innerHTML = JSON.stringify(data, null, 2);
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue