aboutsummaryrefslogtreecommitdiff
path: root/static
diff options
context:
space:
mode:
authorMrArmonius <mrarmonius@gmail.com>2021-07-21 21:22:29 +0200
committerAlex Auvolat <alex@adnab.me>2021-08-16 12:54:08 +0200
commit819d7bf02f1c7b119468c1353b78a3d3bb7015fe (patch)
treef38f3b7267ca0b1d5f4dbfda63820bbde367ba3e /static
parentb1ce932cd67be22d73606f377d2432ea389be71f (diff)
downloadguichet-819d7bf02f1c7b119468c1353b78a3d3bb7015fe.tar.gz
guichet-819d7bf02f1c7b119468c1353b78a3d3bb7015fe.zip
New HTML Directory
Diffstat (limited to 'static')
-rw-r--r--static/javascript/search.js16
1 files changed, 9 insertions, 7 deletions
diff --git a/static/javascript/search.js b/static/javascript/search.js
index ea1e155..b82b232 100644
--- a/static/javascript/search.js
+++ b/static/javascript/search.js
@@ -1,8 +1,8 @@
function searchDirectory() {
var input = document.getElementById("search").value;
-
- var xhttp = new XMLHttpRequest();
- xhttp.onreadystatechange = function() {
+ if(input){
+ var xhttp = new XMLHttpRequest();
+ xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 201) {
// Typical action to be performed when the document is ready:
//Response from Request Ajax
@@ -26,10 +26,12 @@ function searchDirectory() {
}
old_table.parentNode.replaceChild(table, old_table)
}
- };
- xhttp.overrideMimeType("application/json");
- xhttp.open("GET", "/search/".concat(input), true);
- xhttp.send();
+ };
+ xhttp.overrideMimeType("application/json");
+ xhttp.open("GET", "/search/".concat(input), true);
+ xhttp.send();
+ }
+