我试图找到一个twitter bootstrap typeahead元素的工作示例,该元素将进行ajax调用以填充它的下拉列表.
我有一个现有的工作jquery自动完成示例,它定义了ajax url以及如何处理回复
<script type="text/javascript">
//<![CDATA[
$(document).ready(function() {
var options = { minChars:3, max:20 };
$("#runnerquery").autocomplete('./index/runnerfilter/format/html',options).result(
function(event, data, formatted)
{
window.location = "./runner/index/id/"+data[1];
}
);
..
Run Code Online (Sandbox Code Playgroud)
我需要更改什么来将其转换为typeahead示例?
<script type="text/javascript">
//<![CDATA[
$(document).ready(function() {
var options = { source:'/index/runnerfilter/format/html', items:5 };
$("#runnerquery").typeahead(options).result(
function(event, data, formatted)
{
window.location = "./runner/index/id/"+data[1];
}
);
..
Run Code Online (Sandbox Code Playgroud)
jquery jquery-autocomplete jquery-ui-autocomplete twitter-bootstrap typeahead.js