JQuery : Using Twitter Typeahead With A Custom JSON Feed With Example

I recently needed to implement a predictive search in EPiServer that gets generated from custom results from a custom database table which contains the companies products.  The overall concept is that a scheduled task runs nightly to combine 6 different tables into a single JSON feed to potential search terms.  After a bit of Googling I decided to use the Twitter Typeahead but I couldn’t find an easy straightforward demo that I could just download and start playing with, so attached is my TypeaheadExample demo from Github.  It’s based upon a tutorial here with a bit of customization.

Troubleshooting

You need to run the typeahead using a web server, if you just to try to load the file using chrome directly you will get the following error : Failed to load resource: Origin null is not allowed by Access-Control-Allow-Origin.

If you are using IIS, make sure your json is added to your websites allowed MIME types, open IIS -> MIME types -> Add -> ‘json’ and ‘application/json'

 

 

Jon D Jones

Software Architect, Programmer and Technologist Jon Jones is founder and CEO of London-based tech firm Digital Prompt. He has been working in the field for nearly a decade, specializing in new technologies and technical solution research in the web business. A passionate blogger by heart , speaker & consultant from England.. always on the hunt for the next challenge

More Posts

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *