diff options
author | tomsmeding <tom.smeding@gmail.com> | 2020-01-17 22:19:24 +0100 |
---|---|---|
committer | tomsmeding <tom.smeding@gmail.com> | 2020-01-17 22:19:24 +0100 |
commit | e3633fd8e52b866d56422dbe2672c7158f84cc94 (patch) | |
tree | 28e8175b7b8b5fd24547ce63f2987d80145f55d8 /modules | |
parent | d339830afc156f2a93c638df619a6ec1d8d1f71d (diff) |
unicode: Don't send lookup requests for empty string
Diffstat (limited to 'modules')
-rw-r--r-- | modules/unicode/index.html | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/modules/unicode/index.html b/modules/unicode/index.html index 9335081..23492cd 100644 --- a/modules/unicode/index.html +++ b/modules/unicode/index.html @@ -18,6 +18,9 @@ body { </style> <script> function do_lookup() { + var input = document.getElementById("input").value; + if (input.length == 0) return; + var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function() { if (xhr.readyState == 4) { @@ -28,7 +31,8 @@ function do_lookup() { } } }; - xhr.open("GET", "/unicode/lookup/" + encodeURIComponent(document.getElementById("input").value)); + + xhr.open("GET", "/unicode/lookup/" + encodeURIComponent(input)); xhr.responseType = "text"; xhr.setRequestHeader("Content-Type", "text/plain"); xhr.send(); |