Groundwork in base.html and searchsuggestions.js
This commit is contained in:
13
static/dist/js/searchsuggestions.js
vendored
Normal file
13
static/dist/js/searchsuggestions.js
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
const searchinput = document.querySelector("#searchinput");
|
||||
searchinput.addEventListener("input", (e) => {
|
||||
q(e.target.value);
|
||||
});
|
||||
async function q(s) {
|
||||
try {
|
||||
const response = await fetch("http://localhost:8000/api/?q=" + s);
|
||||
const result = await response.json();
|
||||
console.log("Success: " + JSON.stringify(result));
|
||||
} catch(error) {
|
||||
console.log("Error: " + error);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user