forked from MarseyWorld/MarseyWorld
dsf
parent
b3d4f7dd27
commit
ccbf445fba
|
@ -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) {
|
||||
|
|
|
@ -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!";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue