bb
This commit is contained in:
parent
f0fd826b54
commit
68c64a63f3
11 changed files with 40 additions and 17 deletions
|
@ -12,6 +12,8 @@ document.addEventListener("DOMContentLoaded", function(){
|
|||
});
|
||||
|
||||
function post_toast(url, reload, data) {
|
||||
document.getElementById('toast-post-error-text').innerText = "Error, please try again later."
|
||||
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", url, true);
|
||||
var form = new FormData()
|
||||
|
@ -26,7 +28,8 @@ function post_toast(url, reload, data) {
|
|||
xhr.withCredentials=true;
|
||||
|
||||
xhr.onload = function() {
|
||||
let data = JSON.parse(xhr.response)
|
||||
try {let data = JSON.parse(xhr.response)}
|
||||
catch(e) {}
|
||||
if (xhr.status >= 200 && xhr.status < 300 && data && data['message']) {
|
||||
document.getElementById('toast-post-success-text').innerText = data["message"];
|
||||
new bootstrap.Toast(document.getElementById('toast-post-success')).show();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue