这是我执行 typeahead 的 js 代码:
jQuery.noConflict();
jQuery(document).ready(function(){
jQuery('.search-field.input').typeahead({
name: 'group-static',
prefetch: 'http://ws.luyencong.net/data/search/query.php?do=advanced',
header: '<span class="group-title">General Content</span>',
template: [
'<img class="icon" src="{{icon}}" style="width: 38px; height: 38px" />',
'<div class="icon-desc"><span xmlns="http://www.w3.org/1999/xhtml" class="title">{{name}}</span>',
'<span xmlns="http://www.w3.org/1999/xhtml" class="desc">{{description}}</span></div>',
'<span class="clear"></span>'
].join(''),
engine: Hogan
});
});
Typeahead 被执行(因为我可以看到 tt-hint 输入,以及建议 div 的包装)但是有一个问题,当我输入一个字符时,建议没有按应有的方式显示。
我的 JSON 位于:http ://ws.luyancong.net/data/search/query.php?do=advanced
请给我一些帮助。谢谢。