title: How can I resolve the error "Uncaught TypeError: b.slice is not a function" that happens on select2 plugin?
body: <p>I have following jquery function:</p>
  
  <pre><code>$("#cliente").select2({
      placeholder: '--select--',
      minimumInputLength: 3,
      ajax: {
          url: path+'js/php-files/autocomplete.php',
          dataType: 'json',
          delay: 250,
          data: function (params) {
              return {
                  term: params.term // search term
              };
          },
          results: function (data) {
              return {
                  results: data.results
              };
          }
      }
  });
  </code></pre>
  
  <p>In the PHP file (autocomplete.php), I have:</p>
  
  <pre><code>$bo = new ClienteBO();
  $list = $bo-&gt;findAutoComplete($_GET['term']);
  
  $results = array();
  $first = true;
  $count = count($list);
  for ($i = 0; $i &lt; $count; $i++) {
      $results['id'] = $list[$i]['codCliente'];
      $results['text'] = htmlspecialchars($list[$i]['nomeCliente']);
  }
  $ret['results'] = $results;
  echo json_encode($ret);
  </code></pre>
  
  <p>And a HTML file</p>
  
  <pre><code>&lt;div class="form-group"&gt;
      &lt;label for="cliente"&gt;Cliente:&lt;/label&gt;
      &lt;select name="cliente" id="cliente" class="form-control"&gt;
          &lt;option&gt;&lt;/&lt;/option&gt;
      &lt;/select&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>When I see the Console chrome error, I have following result:</p>
  
  <pre><code>Uncaught TypeError: b.slice is not a function               select2.min.js:2
  a.removePlaceholder             @ select2.min.js:2
  j                               @ select2.min.js:1
  a.append                        @ select2.min.js:2
  j                               @ select2.min.js:1
  (anonymous function)            @ select2.min.js:1
  d.invoke                        @ select2.min.js:1
  d.trigger                       @ select2.min.js:1
  e.trigger                       @ select2.min.js:2
  (anonymous function)            @ select2.min.js:2
  (anonymous function)            @ select2.min.js:2
  (anonymous function)            @ jquery.min.js:2
  j                               @ jquery.min.js:2
  k.fireWith                      @ jquery.min.js:2
  x                               @ jquery.min.js:4
  b                               @ jquery.min.js:4
  </code></pre>
  
  <p>I use plugin select2 version 4.0.0.
  How can I resolve this situation?</p>
  
  <p>Thanks!</p>