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