title: laravel select2 error undefined is not a function
body: <p>i am get json encoded data in id text pair 
  results: [{id:2, text:3}, {id:21, text:654}, {id:23, text:12343}, {id:24, text:4536}, {id:28, text:987},…]
  total: 13</p>
  
  <p>my select2 code </p>
  
  <pre><code>$("#model_no_search").select2({
      ajax: {
          url: 'get_model_no',
          dataType: "json",
          type: "POST",
          quietMillis: 500,
          data: function (term, page) {
              return {
                  str:term
              };
          },
          results: function (data, page) {
              console.log(data.results);
              return { results:  data.results };
          }
      },
      allowClear: true,
  });
  </code></pre>
  
  <p>get_model_no function</p>
  
  <pre><code>public function get_model_no($str=0) {
      $data['total'] = Bag_model::leftJoin('category', 'bag.cat_id', '=', 'category.id')
                  -&gt;select('model_no AS text','model_id AS id')-&gt;get()-&gt;count();
  
      $data['results'] = Bag_model::leftJoin('category', 'bag.cat_id', '=', 'category.id')
                  -&gt;select('model_id AS id','model_no AS text')-&gt;get()-&gt;toArray();
  
      echo json_encode($data);
  }
  </code></pre>
  
  <p>in route </p>
  
  <pre><code>Route::post('get_model_no', 'Bag@get_model_no');
  </code></pre>
  
  <p>your help is appriciated.
  thanks in advance.</p>