title: Populate Select2 with AJAX data
body: <p>I'm using Select2 4.0.0-rc.2. </p>
  
  <p>The <a href="https://select2.github.io/options.html#initSelection" rel="nofollow noreferrer">Options page</a> states the following about <code>initSelection</code></p>
  
  <blockquote>
    <p>In the past, Select2 required an option called <code>initSelection</code> that was defined whenever a custom data source was being used, allowing for the initial selection for the component to be determined. This has been replaced by the <code>current</code> method on the <a href="https://select2.github.io/options.html#dataAdapter" rel="nofollow noreferrer">data adapter</a>.</p>
  </blockquote>
  
  <p>I only found examples for older versions of Select2 that use <code>initSelection</code> (see <a href="https://stackoverflow.com/questions/18699641/setting-initial-values-on-load-with-select2-with-ajax">Setting initial values on load with Select2 with Ajax</a>) </p>
  
  <p>How can I load default data with data adapter?</p>
  
  <p>here is my initial code (is twig) </p>
  
  <pre><code> $("#{{ id }}").select2({
              ajax: {
                      url: "{{ path(attr.path) }}",
                      dataType: 'json',
                      {% if attr.placeholder is defined %}
                      placeholder: '{{ attr.placeholder }}',
                      {% endif %}
                      delay: 250,
                      data: function (term) {
                          return term;
                      },
                      processResults: function (data) {
                          return {results: data};
                      }
  
                  },
              templateResult: function(data){
                  return '&lt;img width="30" src="'+data.image+'"&gt;'+data.text;
              },
              templateSelection: function(data){
                  return '&lt;img width="30" src="'+data.image+'"&gt;'+data.text;
              },
  
              cache: true,
              escapeMarkup: function (markup) { return markup; }, // let our custom formatter work
              minimumInputLength: 2
          });
  </code></pre>
  
  <p>If it possible i want setup always visible options and have ajax other, </p>