mirror of
https://github.com/Lukas0025/YAGS.git
synced 2025-04-11 01:42:12 +01:00
58 lines
1.6 KiB
JavaScript
58 lines
1.6 KiB
JavaScript
function updateStation(id) {
|
|
var station = new FormData();
|
|
|
|
var name = document.getElementById("station-name").value;
|
|
var lat = document.getElementById("station-lat").value;
|
|
var lon = document.getElementById("station-lon").value;
|
|
var alt = document.getElementById("station-alt").value;
|
|
var description = document.getElementById("station-description").value;
|
|
|
|
station.append('name', name);
|
|
station.append('lat', lat);
|
|
station.append('lon', lon);
|
|
station.append('alt', alt);
|
|
station.append('description', description);
|
|
station.append('id', id);
|
|
|
|
var xhttp = new XMLHttpRequest();
|
|
xhttp.onreadystatechange = function() {
|
|
if (this.readyState == 4 && this.status == 200) {
|
|
location.reload();
|
|
}
|
|
};
|
|
|
|
xhttp.open("POST", "/api/station/update", true);
|
|
xhttp.send(station);
|
|
}
|
|
|
|
function deleteStation(id) {
|
|
var station = new FormData();
|
|
|
|
station.append('id', id);
|
|
|
|
var xhttp = new XMLHttpRequest();
|
|
xhttp.onreadystatechange = function() {
|
|
if (this.readyState == 4 && this.status == 200) {
|
|
location.reload();
|
|
}
|
|
};
|
|
|
|
xhttp.open("POST", "/api/station/delete", true);
|
|
xhttp.send(station);
|
|
}
|
|
|
|
function apiRegenerate(id) {
|
|
var station = new FormData();
|
|
|
|
station.append('id', id);
|
|
|
|
var xhttp = new XMLHttpRequest();
|
|
xhttp.onreadystatechange = function() {
|
|
if (this.readyState == 4 && this.status == 200) {
|
|
location.reload();
|
|
}
|
|
};
|
|
|
|
xhttp.open("POST", "/api/station/apiRegenerate", true);
|
|
xhttp.send(station);
|
|
} |