Tag: webmethod typeahead.js

将Typeahead.js与ASP.Net Webmethod集成

我正在寻找一个使用Asp.Net Web方法使用Typeahead.js的示例。 我有http://twitter.github.io/typeahead.js/examples/中的示例使用基本示例,但我不完全了解如何使用asp.net webmethod实现Bloodhoundfunction。 typeahead函数调用WebMethod(我可以看到调试器中的步骤)但是没有返回到TypeAhead的列表。 这是标记: 这是jquery: $(document).ready(function () { var textlookup = new Bloodhound({ datumTokenizer: Bloodhound.tokenizers.obj.whitespace(‘value’), queryTokenizer: Bloodhound.tokenizers.whitespace, remote: ‘/WebServices/InternalMethods.asmx/TextAutocomplete?param=%QUERY’ }); textlookup.initialize(); $(‘.autocomplete’).typeahead({ hint: true, highlight: true, minLength: 1 }, { name: ‘textlookup’, displayKey: ‘value’, source: textlookup.ttAdapter() }); }); 这是WebMethod: [WebMethod] [ScriptMethod(ResponseFormat = ResponseFormat.Json)] public List TextAutocomplete(string param) { return Suggestions.TextAutocomplete(param); } 任何帮助表示赞赏。