This commit is contained in:
kek7198 2022-01-03 16:06:36 -06:00
parent 1214f90ba4
commit 2912afe2a0
2 changed files with 4 additions and 4 deletions

View file

@ -255,13 +255,11 @@ function submitFormAjax(e, success, error) {
var myToast = new bootstrap.Toast(document.getElementById('toast-post-success')); var myToast = new bootstrap.Toast(document.getElementById('toast-post-success'));
myToast.show(); myToast.show();
// Run success function // Run success function
success() if (success) success()
return true return true
} else if (xhr.status >= 300 && xhr.status < 400) { } else if (xhr.status >= 300 && xhr.status < 400) {
window.location.href = JSON.parse(xhr.response)["redirect"] window.location.href = JSON.parse(xhr.response)["redirect"]
} else { } else {
// Run error function
error()
try { try {
data=JSON.parse(xhr.response); data=JSON.parse(xhr.response);
var myToast = new bootstrap.Toast(document.getElementById('toast-post-error')); var myToast = new bootstrap.Toast(document.getElementById('toast-post-error'));
@ -275,6 +273,8 @@ function submitFormAjax(e, success, error) {
myToast.show(); myToast.show();
return false return false
} }
// Run error function
if (error) error()
} }
}; };

View file

@ -357,7 +357,7 @@
} }
</script> </script>
{% endif %} {% endif %}
<script src="/static/assets/CHRISTMAS/js/default.js?a=27"></script> <script src="/static/assets/CHRISTMAS/js/default.js?a=28"></script>
</body> </body>
</html> </html>