dropdown empty not working #2854
juanreyeseth
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have this code but it is somewhat unstable.
<script> $(document).ready(function () { $('#CompanyId').change(function () { var companyId = $(this).val(); $.ajax({ url: '/Warehouses/GetBranches', type: 'GET', data: { companyId: companyId }, success: function (data) { $('#BranchId').empty(); $.each(data, function (index, item) { $("#BranchId").append($('<option>', { value: item.id, text: item.name })); }); $("#BranchId").selectpicker('refresh'); } }); }); }); </script>
Even though I try to clean the dropdown, the information from the second dropdown is being duplicated.
Beta Was this translation helpful? Give feedback.
All reactions