aboutsummaryrefslogtreecommitdiff
path: root/static
diff options
context:
space:
mode:
authorMrArmonius <mrarmonius@gmail.com>2021-07-29 10:55:44 +0200
committerAlex Auvolat <alex@adnab.me>2021-08-16 12:54:08 +0200
commit0ca6a159b215967a6d13b9bad5c008983e032c3f (patch)
treedff4603f49961b5a6b30d3cd0dea1b09a9401f58 /static
parent815e9bfe2a912f0804de4882a11fd349b2f4d796 (diff)
downloadguichet-0ca6a159b215967a6d13b9bad5c008983e032c3f.tar.gz
guichet-0ca6a159b215967a6d13b9bad5c008983e032c3f.zip
Message ID send from Client
Remove commentary code Correct Empty answer
Diffstat (limited to 'static')
-rw-r--r--static/javascript/search.js16
1 files changed, 7 insertions, 9 deletions
diff --git a/static/javascript/search.js b/static/javascript/search.js
index 9e078be..6d33fe6 100644
--- a/static/javascript/search.js
+++ b/static/javascript/search.js
@@ -1,4 +1,5 @@
var perso_id = 0;
+var last_id = 0;
function searchDirectory() {
var input = document.getElementById("search").value;
@@ -10,8 +11,8 @@ function searchDirectory() {
//Response from Request Ajax
var jsonResponse = JSON.parse(xhttp.responseText);
- if (perso_id < jsonResponse.id) {
- perso_id = jsonResponse.id
+ if (last_id < jsonResponse.id) {
+ last_id = jsonResponse.id
//We get the old table element, we create an new table element then we increment this new table.
//After the new add, we replace the old table by the new one.
var old_table = document.getElementById("users");
@@ -29,19 +30,16 @@ function searchDirectory() {
identifiant.innerHTML = `<a href="/admin/ldap/${jsonResponse.search[i].dn}">${jsonResponse.search[i].identifiant}</a>`
name.innerHTML = jsonResponse.search[i].name
email.innerHTML = jsonResponse.search[i].email
- description.innerHTML = `${jsonResponse.search[i].description}`
+ description.innerHTML = jsonResponse.search[i].description
}
old_table.parentNode.replaceChild(table, old_table)
}
}
};
+ perso_id += 1
xhttp.overrideMimeType("application/json");
- xhttp.open("GET", "/search/".concat(input), true);
- xhttp.send();
+ xhttp.open("POST", "/search/".concat(input), true);
+ xhttp.send(JSON.stringify({"id": perso_id}));
}
-
-
-
-
} \ No newline at end of file