I am having trouble trying to figure out how to use jQuery autocomplete in the following situation.
I am trying to connect it to a web service that returns a JSON object. The URL form is as follows:
host/api/schools/{search-term}
No query string ?term= or anything else.
How can I configure Autocomplete for this? I am new to JavaScript, but I can get through.
I tried the following bit:
$(...).autocomplete({ source: function(term, callback) { $.getJSON("url", { foo: term }, callback); } });
but cannot pass it to the server host/api/schools/{search-term} (it is host/api/schools/?foo%5Bterm=%5D{search-term} as host/api/schools/?foo%5Bterm=%5D{search-term} when checking with a script where {search-term} - entered text.
reference
source share