Skip to content

nikkipurcell/js-ajax-type-ahead

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

js-ajax-type-ahead

An search input that filters for city, county.

How Its Done

Uses fetch api to retrieve data from a json endpoint. When the input detects change or keyup event a function is called to displayMatches. First we find the match using the string typed and the json data array and filter it to return city and county. In that filter we use regex since the search string is always dynamic. Then map through that result to return a list item of the results for each place. Finally we use innerHTML to replace the existing list items with the resulting list item from the filtered search.

JS Ajax Type Ahead

About

Search input that filters for city & county. It uses fetch api to retreive JSON endpoint.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Contributors