4
我正在使用typeahead.js。我正在使用預取選項,需要解析返回的數據。這不是拋出一個錯誤;它沒有做任何事情。我查找了一些例子,但沒有一個使用Prefetch Filter選項。使用typeahead.js預取過濾器(使用基本選項)
Link to the prefetch documentation
我的代碼(即不工作,但不引發錯誤):
$('#autocomplete').typeahead('destroy').typeahead({
name: 'organizations',
prefetch: {
url: 'jsoncall',
filter: function() {
// Blatant hardcoded return value
return ['test-a','test-b','test'c];
}
}
}
);
我的HTML:
<input id="autocomplete" class="large-12" autocomplete="off" type="text" placeholder="Enter school name">
我的困惑:
0________0
這有助於。 ..http://stackoverflow.com/questions/16321544/twitters-bootstrap-typeahead-setup –
我喜歡幽默 – Meredith