大佬教程收集整理的这篇文章主要介绍了jquery – 将Typeahead.js与ASP.Net Webmethod集成,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我从http://twitter.github.io/typeahead.js/examples/开始使用基本示例,但我不完全了解如何使用asp.net webmethod实现Bloodhound功能.
typeahead函数调用WebMethod(我可以看到调试器中的步骤)但是没有返回到TypeAhead的列表.
这是标记:
<div class="input-group"> <asp:TextBox ID="tBoxText" runat="server" CssClass="form-control autocomplete" placeholder="Look Up"></asp:TextBox> <span class="input-group-btn"> <asp:Button ID="btnAddItem" runat="server" Text="Add" CssClass="btn btn btn-amethyst" /> </span> </div>
这是jquery:
$(document).ready(function () { var textlookup = new Bloodhound({ datumTokenizer: Bloodhound.tokenizers.obj.whitespace('value'),queryTokenizer: Bloodhound.tokenizers.whitespace,remote: '/Web@R_801_9260@ces/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<String> TextAutocomplete(String param) { return Suggestions.TextAutocomplete(param); }
任何帮助表示赞赏.
以上是大佬教程为你收集整理的jquery – 将Typeahead.js与ASP.Net Webmethod集成全部内容,希望文章能够帮你解决jquery – 将Typeahead.js与ASP.Net Webmethod集成所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。