From cead72208205776768b34ddc7e182f7dbb5cc41c Mon Sep 17 00:00:00 2001 From: Scobiform Date: Fri, 19 Apr 2024 18:37:10 +0200 Subject: [PATCH] Add search for user #11 --- templates/index.html | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/templates/index.html b/templates/index.html index 673f40f..d8d9e91 100644 --- a/templates/index.html +++ b/templates/index.html @@ -120,9 +120,17 @@ // Check if the enter key is pressed if (event.key === "Enter") { submitForm(); - } - else { - timeout = setTimeout(submitForm, delay); + } else { + timeout = setTimeout(() => { + const query = document.getElementById('searchUser').value; + fetch(`{{ app_url }}/search?query=${query}`) + .then(response => response.json()) + .then(data => { + displayResults(data); + console.log(data); + }) + .catch(error => console.error('Error:', error)); + }, delay); } }