From 95da39096efef50c4321cbb29af426551ae426e0 Mon Sep 17 00:00:00 2001 From: RevealedFrom Date: Mon, 1 May 2017 11:04:40 +0800 Subject: [PATCH] Update readme.md Added an example for using `source` with `asyncResults`. --- doc/jquery_typeahead.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/jquery_typeahead.md b/doc/jquery_typeahead.md index f6402607..0857fb43 100644 --- a/doc/jquery_typeahead.md +++ b/doc/jquery_typeahead.md @@ -143,6 +143,14 @@ Datasets can be configured using the following options. called with suggestions computed asynchronously (e.g. suggestions that come for an AJAX request). `source` can also be a Bloodhound instance. **Required**. + + Example of use: + + ` source: function ( query, syncResults, asyncResults) { + $.get( '/api/autocomplete/places', { q: query }, function ( data ) { + return asyncResults( data ); + } ); + }` * `async` – Lets the dataset know if async suggestions should be expected. If not set, this information is inferred from the signature of `source` i.e.