使用selectize.js插件,
https://github.com/brianreavis/selectize.js/blob/master/docs/usage.md
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(); }) } });