我想创建一个可以标记或提及用户的应用程序,我正在使用此插件https://yuku-t.com/jquery-textcomplete/
但我无法显示来自php json编码数据的数据
小提琴:https://jsfiddle.net/gtjL9ruy/
$('.textarea4').textcomplete([
{
match: /(^|\s)@(\w*)$/,
search: function (term, callback) {
callback(cache[term], true);
$.getJSON('http://www.jsoneditoronline.org/?id=d6b7ebe62f80da1c206f0653fe87f859', { q: term })
.done(function (resp) { callback(resp); })
.fail(function () { callback([]); });
},
replace: function (value) {
return '$1@' + value + ' ';
},
cache: true
}
], { maxCount: 20, debounce: 500 });