2012-10-25 52 views

回答

2

the typeahead doc

The function is passed two arguments, the query value in the input field and the process callback. The function may be used synchronously by returning the data source directly or asynchronously via the process callback's single argument.

正確的函數參數:

var searchFunction = function(query, process) { 
    var result = "result1::result2".split("::"); 
    process(result); 
} 

Demo (jsfiddle)