Problem loading Bootstrap Select options via Ajax Post

Using Bootstrap 3 and Bootstrap-Select plugin. I am trying to load drop down ajax parameters from database.the code, which works fine when I remove select pickerlass from an element select, but with this class (which needs to be used to select bootstrap), it does not load any parameters.

 <select id="arearesults" class="selectpicker" data-live-search="true">
    <option value="select">Select From The List</option>
 </select>

$('.btn-group .btn').click(function(){
    $.post(
    'con/animalList.php',
    { selType : this.id },
    function(data)
                {
                  $('#arearesults').html(data);
                }
    );
});

I have already tested the bootstrap boot plugin and also works offline (hard-coded). Could you tell me why this is happening and how I can solve this problem?

thank

+4
source share
2 answers

.

  • data-type $.post. "JSON" "html" ..

  • AJAX selectbox . :

    $('#arearesults').selectpicker("refresh");
    
+7

  $('.selectpicker').selectpicker({});
+2

Source: https://habr.com/ru/post/1538804/


All Articles