-
I have a requirement where the suggestions will change based on the user input, I have to call an API with the value entered in the input field and the response differs for each value.( I have to map the response as the data for autoComplete) I can see the data item being set in the sample code is Any help or suggestions would be great |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
let foo = new autoComplete({
data: {
src: async q => {
let data
let url = new URL(...)
url.searchParams.append("search", q)
await fetch(url, stdparams)
.then(json => (data = json))
return data.foo
},
keys: ["bar", "baz"],
cache: false
}
}) |
Beta Was this translation helpful? Give feedback.
q
is the query as written in the input field and potentially modified byconfig.query
for sanitization etc.