title: get current element in select2
body: <p>I want to use multiple select2 by using a class, like I am doing in autocomplete, but I am failing to do same in select2.</p>
  
  <p>here is my code:</p>
  
  <pre><code>$('.select2-autocomplete').select2({
    placeholder: "Search",
    minimumInputLength: 1,
    multiple: true,
    ajax: {
      url: "http://example.com/autocomplete-results",
      dataType: 'json',
      data: function(term, page) {
        return {
          q: term,
          type: $(this.element).data('type')
        };
      },
      results: function(data, page) {
        return {
          results: data
        };
      }
    },
  });
  </code></pre>
  
  <p>Everything is working fine except this :</p>
  
  <pre><code>type : $(this.element).data('type') 
  </code></pre>
  
  <p>Here I need the select2 element data-type value, but it is always undefined any idea how I can get that?</p>
  
  <p>Thanks</p>
  
  <p>Edit:</p>
  
  <pre><code>&lt;input type="hidden" data-type="products" name="products" class="select2-autocomplete"&gt;
  &lt;input type="hidden" data-type="customers" name="customers" class="select2-autocomplete"&gt;
  </code></pre>
  
  <p>I want to show different results from ajax that is the reason I want to send data-type via ajax</p>