title: Summernote get mentions from php
body: <p>I am using Summernote editor with mentions (@username). (<a href="https://summernote.org/examples/#hint-for-mention" rel="nofollow noreferrer">https://summernote.org/examples/#hint-for-mention</a>)
  I am looking for a way to load the array of usernames into Summernote.
  What I've tried: (with help from <a href="https://stackoverflow.com/questions/34883780/jquery-promises-with-summernote-hints">jQuery promises with summernote hints</a>)</p>
  
  <pre><code>$(document).ready(function()
  {
      $('.editor').summernote({
          height: 300,
          hint: {
               match: /\B@(\w*)$/,
               users: function(keyword, callback) {
                   $.ajax({
                       url: '{path}/get_users/' + keyword,
                       type: 'get',
                       async: true
                   }).done(callback);
               },
               search: function (keyword, callback) {
                   this.users(keyword, callback);
               },
               content: function (item) {
                   return '@' + item;
               }
         });
     });
  });
  </code></pre>
  
  <p>The PHP that returns the array of usernames:</p>
  
  <pre><code>public function get_users($keyword='')
  {
      $ar = array('jayden', 'sam', 'alvin', 'david');
      echo json_encode($ar); // returns ['jayden', 'sam', 'alvin', 'david']
  }
  </code></pre>
  
  <p>The result:</p>
  
  <pre><code>Uncaught TypeError: items.map is not a function
      at HintPopover.createItemTemplates (summernote.js:7625)
      at Object.&lt;anonymous&gt; (summernote.js:7672)
      at i (jquery-3.2.1.min.js:2)
      at Object.fireWith [as resolveWith] (jquery-3.2.1.min.js:2)
      at A (jquery-3.2.1.min.js:4)
      at XMLHttpRequest.&lt;anonymous&gt; (jquery-3.2.1.min.js:4)
  </code></pre>
  
  <p>It seems like this.users is not recognised as an Array... 
  Thank you for your advice... </p>