Show only related Items in dropdownList
I have two dropdownlist and want to show only related items. When the first dropdown item is selected show the item in the second dropdown based on their ID's. Don't show everything.
Below is my Jquery
- <script type="text/javascript">
- $('#ddltest').change(function () {
- var contId = $("#ddltest").val();
- var _tt = $(this).val();
- $.ajax({
- type: "GET",
- dataType: "json",
- url: "/Upload/Load",
- data: { id: contId },
- success: function (data) {
- $.each(data, function (i, events) {
- $("#ddlmore").append('<option value="'
- + events.Value + '">'
- + events.Text + '</option>');
- });
- },
- error: function (xhr) {
- alert('Sorry selection ');
- }
- });
- });
- </script>
- When WD/TO is selected show only related item based on their ID in the --Select A CDRL Number-- dropdown