在另一个选择更改后尝试在选择框上加载数据时遇到问题。我尝试了很多方法,但没有用。
我正在使用的模板是https://graygrids.com/item/jobboard-bootstrap-html-job-portal-template/中的工作板
这些是我使用的没有结果的说明:
$('select').select();
$('.mdb-select').materialSelect();
$('.selectpicker').materialSelect();
我的代码是:
$.ajax({
type: "POST",
url: "libs/php/jquery/index.php",
data:
{
funcion: 'getPositionList'
},
success: function(datos)
{
$('select').select();
$('#slkt_positionList').html(datos);
}
});
$('#slkt_positionList').change(function()
{
var var_position = $('#slkt_positionList').val();
if(var_position > 1)
{
$.ajax({
type: "POST",
url: "libs/php/jquery/index.php",
data:
{
funcion: 'getPlacesOffered',
position: var_position
},
success: function(datos)
{
alert(datos);
$('select').select();
$('#slkt_municipalityList').html(datos);
}
});
}
});
组合框如下:
<div class="col-md-3 col-sm-6">
<div class="search-category-container">
<label class="styled-select">
<select class="dropdown-product selectpicker" id="slkt_positionList">
</select>
</label>
</div>
</div>
<div class="col-md-4 col-sm-6">
<div class="search-category-container">
<label class="styled-select">
<select class="dropdown-product selectpicker" id="slkt_municipalityList">
</select>
</label>
</div>
</div>