diff --git a/docs/_includes/options/data/ajax.html b/docs/_includes/options/data/ajax.html index 2f928463..ad1b4e92 100644 --- a/docs/_includes/options/data/ajax.html +++ b/docs/_includes/options/data/ajax.html @@ -20,15 +20,30 @@

- When you aren't using custom formatting functions (templateResult and templateSelection or formatResults) the data returned by the data provider or by processResults should be a list of objects. The objects should contain an id and a text property. The text property will be displayed. See What properties are required on the objects passed in to the array?. + The data returned by the data provider or by processResults should be a JSON object containing an array of objects keyed by the results key.

- -{% highlight js linenos %} -[ - {id: 'id1', text: 'option1'}, - {id: 'id2', text: 'option2'}, - {id: 'id3', text: 'option3'}, -] +

+ Each object should contain, at a minimum, an id and a text property. The text property will be displayed by default, unless you are using templateResult and templateSelection to customize the way options and selections are rendered. +

+

+ The response object may also contain pagination data, if you would like to use the "infinite scroll" feature. See "What properties are required on the objects passed in to the array?" for more information. A complete example is as follows: +

+{% highlight json linenos %} +{ + "results": [ + { + "id": "1", + "text": "Option 1" + }, + { + "id": "2", + "text": "Option 2" + } + ], + "pagination": { + "more": true + } +} {% endhighlight %}