master
Aevann1 2021-09-26 12:18:04 +02:00
parent b3d4f7dd27
commit ccbf445fba
2 changed files with 4 additions and 24 deletions

View File

@ -9,29 +9,7 @@
xhr.withCredentials=true;
xhr.onload = function() {
if (xhr.status==204) {}
else if (xhr.status >= 200 && xhr.status < 300) {
$('#toast-post-success').toast('dispose');
$('#toast-post-success').toast('show');
document.getElementById('toast-post-success-text').innerText = JSON.parse(xhr.response)["message"];
callback(xhr)
return true
} else if (xhr.status >= 300 && xhr.status < 400) {
window.location.href = JSON.parse(xhr.response)["redirect"]
} else {
data=JSON.parse(xhr.response);
$('#toast-post-error').toast('dispose');
$('#toast-post-error').toast('show');
document.getElementById('toast-post-error-text').innerText = data["error"];
return false
}
};
xhr.send(form);
}
var upvote = function(event) {

View File

@ -372,8 +372,10 @@
document.getElementById(button1).classList.toggle("d-md-inline-block");
document.getElementById(button2).classList.toggle("d-md-inline-block");
document.getElementById('toast-post-success').toast('dispose');
document.getElementById('toast-post-success').toast('show');
var myToast = new bootstrap.Toast(document.getElementById('toast-post-success'));
myToast.hide();
myToast.show();
if (distinguish=='yes') {
document.getElementById('toast-post-success-text').innerText = "Comment distinguished!";
}