Show error message when preview fails
This commit is contained in:
parent
badc2a452f
commit
6861a6dd97
@ -23,7 +23,11 @@ document.querySelectorAll('.tooltip.xref').forEach(function(el) {
|
|||||||
|
|
||||||
var xhr = new XMLHttpRequest();
|
var xhr = new XMLHttpRequest();
|
||||||
xhr.addEventListener('load', function() {
|
xhr.addEventListener('load', function() {
|
||||||
|
if (xhr.status == 200) {
|
||||||
el.querySelector('.tooltip-content').innerHTML = xhr.responseText;
|
el.querySelector('.tooltip-content').innerHTML = xhr.responseText;
|
||||||
|
} else {
|
||||||
|
el.querySelector('.tooltip-content').innerHTML = 'Error';
|
||||||
|
}
|
||||||
})
|
})
|
||||||
xhr.open('GET', '/preview/' + el.dataset['xref']);
|
xhr.open('GET', '/preview/' + el.dataset['xref']);
|
||||||
xhr.send();
|
xhr.send();
|
||||||
|
Reference in New Issue
Block a user