This commit is contained in:
Aevann1 2021-12-31 15:02:54 +02:00
parent bb7258f786
commit f8256fd405
8 changed files with 11 additions and 7 deletions

View file

@ -15,7 +15,8 @@ function post_toast2(url, button1, button2) {
xhr.withCredentials=true;
xhr.onload = function() {
let data = JSON.parse(xhr.response)
try {let data = JSON.parse(xhr.response)}
catch(e) {new bootstrap.Toast(document.getElementById('toast-post-error')).show();}
if (xhr.status >= 200 && xhr.status < 300 && !data['error']) {
document.getElementById('toast-post-success-text').innerText = data["message"];
new bootstrap.Toast(document.getElementById('toast-post-success')).show();