+ now correctly working error messages
Signed-off-by: Johannes Theiner <j.theiner@live.de>
This commit is contained in:
parent
4068239070
commit
e0bfd8826f
|
@ -17,27 +17,23 @@ form.onsubmit = function (event) {
|
|||
|
||||
let xhr = new XMLHttpRequest();
|
||||
|
||||
xhr.onloadstart = function(e) {
|
||||
xhr.onloadstart = function (e) {
|
||||
loading.removeClass("hide");
|
||||
$('.sidenav').sidenav('close');
|
||||
loading.modal('open');
|
||||
};
|
||||
|
||||
xhr.onreadystatechange = function() {
|
||||
if (xhr.readyState == XMLHttpRequest.DONE) {
|
||||
if(xhr.responseText != null) {
|
||||
loading.modal('close');
|
||||
console.log(xhr.responseText);
|
||||
$('#error-message').text(xhr.responseText);
|
||||
error.modal('open');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
xhr.onloadend = function (e) {
|
||||
clearSelected();
|
||||
if (/[a-z]/.test(xhr.responseText)) {
|
||||
console.log(xhr.responseText);
|
||||
loading.modal('close');
|
||||
$('#error-message').text(xhr.responseText);
|
||||
error.modal('open');
|
||||
}
|
||||
updateDatasets();
|
||||
form.reset();
|
||||
|
||||
};
|
||||
|
||||
xhr.open('POST', form.getAttribute('action'), true);
|
||||
|
|
|
@ -144,15 +144,16 @@
|
|||
<div class="modal-footer">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="error" class="modal">
|
||||
<div class="modal-content">
|
||||
<h4>Es ist ein Fehler aufgetreten</h4>
|
||||
<p id="error-message">A bunch of text</p>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<a href="#!" class="modal-close waves-effect waves-green btn-flat">Ok</a>
|
||||
</div>
|
||||
<div id="error" class="modal">
|
||||
<div class="modal-content">
|
||||
<i class="material-icons">error_outline</i>
|
||||
<h2 class="center">Fehler</h2>
|
||||
<h4 id="error-message" class="center">Hallo Welt, das sollte nie zu sehen sein.</h4>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<a href="#!" class="modal-close waves-effect waves-green btn-flat">Ok</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
Loading…
Reference in New Issue