Commit 966ac6ea authored by Robert Czechowski's avatar Robert Czechowski

Admin interface: Confirm deletion of participations

parent a9d6a7cc
......@@ -28,26 +28,28 @@
<div id="deleted" style="color:black;"></div>
<script>
document.getElementById("delete").onsubmit = function(event) {
var xhr = new XMLHttpRequest();
xhr.open("POST", window.location.href, true);
xhr.onreadystatechange = function() {
if (this.readyState === XMLHttpRequest.DONE) {
if (this.status === 200) {
result = JSON.parse(this.responseText);
if (result.status == "ok") {
document.getElementsByTagName("body")[0].style.color = "gray";
document.getElementById("delete").style.display = "None";
document.getElementById("deleted").innerText = "Teilnahme gelöscht.";
} else {
alert("Kann Teilnahme nicht löschen: " + result.reason);
if (confirm("Teilnahme wirklich löschen?")) {
var xhr = new XMLHttpRequest();
xhr.open("POST", window.location.href, true);
xhr.onreadystatechange = function() {
if (this.readyState === XMLHttpRequest.DONE) {
if (this.status === 200) {
result = JSON.parse(this.responseText);
if (result.status == "ok") {
document.getElementsByTagName("body")[0].style.color = "gray";
document.getElementById("delete").style.display = "None";
document.getElementById("deleted").innerText = "Teilnahme gelöscht.";
} else {
alert("Kann Teilnahme nicht löschen: " + result.reason);
}
}
else {
alert("Request error " + this.status + ": " + this.statusText);
}
}
else {
alert("Request error " + this.status + ": " + this.statusText);
}
}
xhr.send("csrf_token={{csrf_token}}");
}
xhr.send("csrf_token={{csrf_token}}");
return false;
};
</script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment