I need to build an ajax search function which, as the user types, will narrow down a displayed list to show only exact matches.
I’m not looking for someone to do my work for me, but some specific tips would be greatly appreciated.
Specifically:
-I’ve been trying to find a tutorial online, but all the examples i find involve pulling new search results as the user types, which isnt quite what i want. Does anyone know of any resources which would give me the information needed?
-Also, Aside from basic ajax framework, like building the httprequest object, what is the general logic of what i would have to do to implement something like this?
In detail, I have a dynamically displayed list of contents from a database. I have shoved the output into an array, which is displayed to the user. Thus, i have my list of contents that will need to be tapered.
So i need to find a way to narrow down this specific outputted array as the user types.
Sorry if I’m not being specific enough, i’m trying to give as much info as possible.
Any advice will be appreciated!
Many JS typeahead scripts have this built in. You get the option to either pull data from ajax call or a pre-populated array/json. Consider twitter bootstrap typeahead example, where you can provide
data-sourceto populate from.