如何从 MooTools 自动完成器的数据库中获取建议文本?
我需要一个文本区域多自动完成器,例如 this。
但是,在示例中,选项是本地的。有谁知道我如何从数据库中获取我的选项?
I need a textarea multi auto-completer like this.
However, in the example, the options are local. Does anyone know how I could get my options from a database?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您只需初始化
tokens
数组即可从数据库中获取所有值。请注意,仅当从数据库中获取的单词数不太大(最多数百、半千)时,这才有效。如果这不是您的情况,并且您的数据库中有很多单词,那么您必须考虑 AJAX 自动完成器解决方案。
You can simply initialize the
tokens
array fetching all the values from the database. Be careful, this is good only if the number of words fetched fromm the database is not too big (hundreds, half a thousand maximum).If it's not your case, and you have lots of words in your database, you have to think about an AJAX autocompleter solution.
我刚刚发布了一个,因为很多人似乎都在追求这种标记(我责怪 google+),并且我已经将其编写并放在我的 github 存储库中。
如果您可以从源代码中解决它,因为我没有时间记录和支持这一点,祝您好运: http: //mootools.net/forge/p/mootagify
提示:您传递已配置的 Request.JSON 实例,您设置该实例来获取标签 - onSuccess 事件由
autoCompleter
处理班级(这是一个独立的)。github来源:https://github.com/DimitarChristoff/mooTagify/
I've just released one since a lot of people seem to be after this kind of tagging (I blame google+) and I had it written and in my github repos already.
If you can work it out from the source as I have no time to document and support this, good luck: http://mootools.net/forge/p/mootagify
hint: you pass on the configured Request.JSON instance, which you setup to get the tags - the onSuccess event is handled by the
autoCompleter
class (which is a standalone).github sources: https://github.com/DimitarChristoff/mooTagify/