bootstrap typeahead return name and id

前端 未结 6 1489
予麋鹿
予麋鹿 2021-02-03 13:33

Hy! I\'m using twitter bootstraps typeahead:

I\'m calling a page that returns a response with json_encode the page returns a name and an ID,

I want that the type

6条回答
  •  再見小時候
    2021-02-03 14:13

    Sorry to "resurect" this post but i was going to be crazy !

    If some of you have problems using theses sample codes ( none of them were working, all were returning "Undefined" instead of showing the name

    Just add

    displayKey: 'name',
    

    Replace of course 'name' by your label var name returned by your remote source

    ( Quite hard to find up to date samples on it, most of samples found on the net are for the previous version of typeahead and not compatibles with new ones ... )

提交回复
热议问题