1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/snserver_ynh.git synced 2024-09-03 20:26:22 +02:00
snserver_ynh/sources/extra_files/app/public/extensions/js.js
2021-01-24 13:30:35 +01:00

23 lines
627 B
JavaScript

loadJSON("index.json");
function loadJSON(file){
fetch(file)
.then(function (response) {
return response.json();
})
.then(function (data) {
appendData(data);
})
.catch(function (err) {
console.log('error: ' + err);
});
}
function appendData(data) {
for (var i = 0; i < data.length; i++) {
var mainContainer = document.getElementById(data[i].extension + "sData");
var tr = document.createElement("tr");
tr.innerHTML =
"<td id='name'>" + data[i].name + "</td>" +
"<td id='url'><a href=" + data[i].url + ">" + data[i].url + "</a></td>"
mainContainer.appendChild(tr);
}
}