3
我如何使用JSON的Twitter Bootstrap Typeahead。我的引導版本是2.2.1 Twitter與JSON的自舉typeahead
我的JSON響應
[{"label":"Sistemski Administrator","value":"1"},{"label":"Jure Hotujec","value":"3"},{"label":" ","value":"4"},{"label":"Simona Jamnik","value":"5"},{"label":"Ma\u0161a Mu\u0161i\u010d","value":"6"},{"label":" ","value":"7"}]
所有我現在所得到的是這一點,但源必須是陣列,在我的情況下,它是JSON
$("#typeahead").autocomplete({
soruce : soruce
});
另外我想使用它與模態元素,如果這改變了什麼。
謝謝!
哇感謝,有沒有什麼辦法,當我選擇一個標籤,我得到返回的值,如回調或東西..謝謝! – intelis
@ user1141356是的。您可以使用[docs。](http://twitter.github.com/bootstrap/javascript.html#typeahead)中指定的'updater'選項。請查看[本教程](http://tatiyants.com)/how-to-use-json-objects-with-twitter-bootstrap-typeahead /)在typeahead選項上。 – rosshamish