wip
This commit is contained in:
parent
1cbbc95856
commit
19af1022da
|
@ -26,7 +26,7 @@ function summarizeButtonClick(button) {
|
||||||
var container = button.parentNode;
|
var container = button.parentNode;
|
||||||
|
|
||||||
container.classList.add('alert');
|
container.classList.add('alert');
|
||||||
container.classList.add('alert-warning');
|
container.classList.add('alert-warn');
|
||||||
container.innerHTML = loadingMsg;
|
container.innerHTML = loadingMsg;
|
||||||
|
|
||||||
var request = new XMLHttpRequest();
|
var request = new XMLHttpRequest();
|
||||||
|
@ -47,14 +47,20 @@ function summarizeButtonClick(button) {
|
||||||
return request.onerror(e);
|
return request.onerror(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
container.classList.remove('alert-warning');
|
if (response.response.error) {
|
||||||
|
container.classList.remove('alert-warn');
|
||||||
|
container.classList.add('alert-error');
|
||||||
|
} else {
|
||||||
|
container.classList.remove('alert-warn');
|
||||||
container.classList.add('alert-success');
|
container.classList.add('alert-success');
|
||||||
container.innerHTML = response.response.output_text.replace('\n', '<br>');
|
}
|
||||||
|
|
||||||
|
container.innerHTML = response.response.output_text;
|
||||||
}
|
}
|
||||||
|
|
||||||
request.onerror = function(e) {
|
request.onerror = function(e) {
|
||||||
badAjax(this.status == 403);
|
badAjax(this.status == 403);
|
||||||
container.classList.remove('alert-warning');
|
container.classList.remove('alert-warn');
|
||||||
container.classList.add('alert-error');
|
container.classList.add('alert-error');
|
||||||
container.innerHTML = errorMsg;
|
container.innerHTML = errorMsg;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue