我试试这个:
$('input[name=recerv_country]').typeahead({
remote : {
url: '?country=%QUERY',
filter: function(data) {
var resultList = data.map(function (item) {
return item.name;
});
return resultList;
}
},
updater : function (item) {
//item = selected item
//do your stuff.
alert(item.name);
alert('foo');
alert('bar');
//dont forget to return the item to reflect them into input
return item;
}
});
什么都没有发生,没有出现警报。我做错了什么?