Jquery textcomplete不显示来自服务器的数据

时间:2017-05-18 06:45:23

标签: javascript php jquery autocomplete

我想创建一个可以标记或提及用户的应用程序,我正在使用此插件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 });

0 个答案:

没有答案