【发布时间】:2020-09-21 22:31:17
【问题描述】:
我正在使用 Razor 页面
我有 2 个下拉列表
如您所见,使用 jquery 选择第一个的索引更改时,第二个正在填充p>
<script>
$(document).ready(function () {
$("#nomclient").on("change", function () {
$list = $("#idconnexion");
$.ajax({
url: "/api/ddl",
type: "GET",
data: { id: $("#nomclient").val() }, //id of the state which is used to extract cities
traditional: true,
success: function (result) {
$list.empty();
$.each(result, function (i, item) {
$list.append('<option value="' + item["idConnexion1"] + '"> ' + item["idConnexion1"] + ' </option>');
});
},
});
});
});
</script>
它工作正常。
问题是当我添加这个
$("#idconnexion").chosen({ width: '90%' });
第二个下拉列表没有填充,但是当我删除它时,它会再次填充。
任何建议
【问题讨论】:
标签: jquery dropdown jquery-chosen