`
wutao8818
  • 浏览: 607134 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

Ajax Typeahead

    博客分类:
  • js
阅读更多
https://github.com/pwarelis/Ajax-Typeahead

$("#ajax-typeahead").typeahead({
    ajax: {
        url: "/path/to/source",
        timeout: 500,
        displayField: "name",
        triggerLength: 1,
        method: "get",
        loadingClass: "loading-circle",
        preDispatch: function (query) {
            showLoadingMask(true);
            return {
                search: query,
                otherParam: 123
            }
        },
        preProcess: function (data) {
            showLoadingMask(false);
            if (data.success === false) {
                // Hide the list, there was some error
                return false;
            }
            // We good!
            return data.mylist;
        }
    }
});
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics