Comment UV API and fix little bugs

This commit is contained in:
tleb
2019-10-18 18:13:53 +02:00
parent dbe44a9c1c
commit bddb88d97f
5 changed files with 247 additions and 205 deletions

View File

@ -52,7 +52,11 @@
year--
}
const url = "{{ url('api:uv_endpoint') }}?year=" + year + "&code=" + codeInput.value
$.getJSON(url, function(data) {
$.getJSON(url, function(data, _, xhr) {
if (xhr.status != 200) {
alert('{% trans %}Unknown UV code{% endtrans %}')
return
}
for (let key in data) {
if (data.hasOwnProperty(key)) {
const el = document.querySelector('[name="' + key + '"]')