diff --git a/files/templates/comments.html b/files/templates/comments.html index de7aa453cb..c7c0c5016f 100644 --- a/files/templates/comments.html +++ b/files/templates/comments.html @@ -19,8 +19,9 @@ xhr.onload = function() { if (xhr.status >= 200 && xhr.status < 300) { - 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(); try { document.getElementById('toast-post-success-text').innerText = JSON.parse(xhr.response)["message"]; } catch(e) { @@ -34,14 +35,18 @@ try { data=JSON.parse(xhr.response); - document.getElementById('toast-post-error').toast('dispose'); - document.getElementById('toast-post-error').toast('show'); + var myToast = new bootstrap.Toast(document.getElementById('toast-post-error')); + myToast.hide(); + myToast.show(); document.getElementById('toast-post-error-text').innerText = data["error"]; return false } catch(e) { - document.getElementById('toast-post-success').toast('dispose'); - document.getElementById('toast-post-error').toast('dispose'); - document.getElementById('toast-post-error').toast('show'); + var myToast = new bootstrap.Toast(document.getElementById('toast-post-success')); + myToast.hide(); + + var myToast = new bootstrap.Toast(document.getElementById('toast-post-error')); + myToast.hide(); + myToast.show(); document.getElementById('toast-post-error-text').innerText = "Error. Try again later."; return false } @@ -412,8 +417,9 @@ document.getElementById(button1).classList.toggle("d-none"); document.getElementById(button2).classList.toggle("d-none"); - 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!"; } @@ -489,7 +495,7 @@