Creating an autocomplete search feature
This recipe will show you how to suggest search terms to a user as they are typing into a search input. This is a very popular feature and can be very helpful to the user as it provides them with some insight into what search results will be available before they have even made the search. jQuery UI provides the autocomplete functionality that can be quickly added to any input element.
Getting ready
Create recipe-5.html
, recipe-5.js
, and recipe-5.css
in the chapter9
folder, where you have saved the other recipe files.
This recipe utilizes a quality API provided by Trakt.tv (http://trakt.tv/api-docs/). You will need to register (for free) and obtain an API key before you can begin this recipe. Once you have registered, you can find your API key on the following page: http://trakt.tv/api-docs/authentication.
Note
At the point of writing this recipe, there is a known bug within Google Chrome, where if you are trying to call an external source using AJAX in...