title: Load Bootstrap-Multiselect based on optgroup using jquery
body: <p>I'm using <a href="https://github.com/snapappointments/bootstrap-select" rel="nofollow noreferrer">Bootstrap-select</a> like bellow:</p>
  
  <pre><code> &lt;label for="name"&gt;CARS&lt;/label&gt;
      &lt;select multiple title="Cars" class="selectpicker cars" id="cars"&gt;
        &lt;optgroup label="Car"&gt;
          &lt;option&gt;Benz&lt;/option&gt;
          &lt;option&gt;BMW&lt;/option&gt;
          &lt;option&gt;Volvo&lt;/option&gt;
          &lt;option&gt;Hyundai&lt;/option&gt;
        &lt;/optgroup&gt;
        &lt;optgroup label="Bike"&gt;
          &lt;option&gt;Benz&lt;/option&gt;
          &lt;option&gt;BMW&lt;/option&gt;
          &lt;option&gt;Volvo&lt;/option&gt;
          &lt;option&gt;Hyundai&lt;/option&gt;
        &lt;/optgroup&gt;
        &lt;optgroup label="Bicycle"&gt;
          &lt;option&gt;Benz&lt;/option&gt;
          &lt;option&gt;BMW&lt;/option&gt;
          &lt;option&gt;Volvo&lt;/option&gt;
          &lt;option&gt;Hyundai&lt;/option&gt;
        &lt;/optgroup&gt;
      &lt;/select&gt;
  </code></pre>
  
  <p>And I want to load it (select options) based on the Ajax call. I know how to use Ajax call but I don't know how to populate multiselect (select options) based on optgroup. because as you see it has the same options in different optgropus.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <pre><code>$(document).on('click', '.ModalButton', function(ev){ 
      ev.preventDefault();
      var url = $(this).data("form"); 
      var company_name = $(this).data('target');
      $(".Modal").unbind().load(url, function() { 
          $.ajax({
              type: "GET",
              url: "/app/edit/",
              data: {
                  company_name: company_name,
                  csrfmiddlewaretoken: document.getElementsByName('csrfmiddlewaretoken')[0].value
              },
              success: function(data) {
                  &lt;&lt;&lt;&lt;&lt;&lt; Multiselect Populating Code should be placed here &gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;
              }
          });
          $(this).modal('show');
      });
      return false;
  });
  </code></pre>
  
  <p>The Ajax response will be:</p>
  
  <pre><code>Car: Benz, Car: BMW, Bike: Benz, Bicycle: Volvo
  </code></pre>