aboutsummaryrefslogtreecommitdiff
path: root/static/javascript/search.js
diff options
context:
space:
mode:
Diffstat (limited to 'static/javascript/search.js')
-rw-r--r--static/javascript/search.js30
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);
}