jquery – Selectize.js =如何阻止它自动加载远程数据 – 建议来源?

使用selectize.js插件,
https://github.com/brianreavis/selectize.js/blob/master/docs/usage.md

每当我输入输入字段时,似乎都会调整load()函数.

我只是想在初始化期间加载一次…在这一小时试图找出它……我感觉它没有这样的功能,或者我错过了什么?

多谢你们…

解决方法

要仅在第一次进行选择性输入加载时,您可以执行以下操作:
$('#select').selectize({
    preload: true,// make selectize load options after initialization
    load: function(query,callback){
        this.settings.load = null; // prevent selectize from loading when typing
        // also instead of this you can 
        // override this.onSearchChange = function noop(){};
        $.ajax({...}).then(function(response){
            callback(response);
        },function(){
            callback();
        }) 
    }
});

相关文章

jQuery表单验证提交:前台验证一(图文+视频)
jQuery表单验证提交:前台验证二(图文+视频)
jQuery如何实时监听获取input输入框的值
JQuery怎么判断元素是否存在
jQuery如何实现定时重定向
jquery如何获取复选框选中的值