diff options
author | darkgallium <darkgallium@deuxfleurs.fr> | 2021-08-18 12:44:44 +0200 |
---|---|---|
committer | darkgallium <darkgallium@deuxfleurs.fr> | 2021-08-18 12:44:44 +0200 |
commit | 59c29e9c76952933c19f2ae9d9ae0bf7076d7e35 (patch) | |
tree | 9edebe95b65254f60a087a24219148b637f87e7b /static | |
parent | a187ae72cbd5960a0778679fba7535d67796f27e (diff) | |
download | guichet-show-everyone-by-default.tar.gz guichet-show-everyone-by-default.zip |
show everyone in the directory page by defaultshow-everyone-by-default
Diffstat (limited to 'static')
-rw-r--r-- | static/javascript/search.js | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/static/javascript/search.js b/static/javascript/search.js index 2a75889..be3bd86 100644 --- a/static/javascript/search.js +++ b/static/javascript/search.js @@ -2,23 +2,21 @@ var last_id = 0; function searchDirectory() { var input = document.getElementById("search").value; - if(input){ - last_id++; - var request_id = last_id; + last_id++; + var request_id = last_id; - var data = new FormData(); - data.append("query", input); + var data = new FormData(); + data.append("query", input); - var xhttp = new XMLHttpRequest(); - xhttp.onreadystatechange = function() { - if (request_id != last_id) return; + var xhttp = new XMLHttpRequest(); + xhttp.onreadystatechange = function() { + if (request_id != last_id) return; - if (this.readyState == 4 && this.status == 200) { - var result_div = document.getElementById("search-results"); - result_div.innerHTML = xhttp.responseText; - } - }; - xhttp.open("POST", "/directory/search", true); - xhttp.send(data); - } + if (this.readyState == 4 && this.status == 200) { + var result_div = document.getElementById("search-results"); + result_div.innerHTML = xhttp.responseText; + } + }; + xhttp.open("POST", "/directory/search", true); + xhttp.send(data); } |