how to Get Record from Database in Search Dropdownlist (select.min.js) - B M SOLUTION
  • how to Get Record from Database in Search Dropdownlist (select.min.js)

      

    <script type="text/javascript">

        $('#drPatient').change(function () {

            var Id = $('#drPatient').val();

            if (Id != "") {

                $.ajax({

                    url: '/Hospital/GetPatientDetail_IPD',

                    dataType: "json",

                    type: "POST",

                    contentType: 'application/json; charset=utf-8',

                    data: JSON.stringify({ Id: Id }),

                    async: true,

                    processData: false,

                    cache: false,

                    success: FillSubDistrict,

                    error: function (xhr) {

                    }

                });

            }

        });

        function FillSubDistrict(result) {


            var items = result.SubDistrictList;

            for (i = 0; i < items.length; i++) {

                $('#drPatient option:selected').text(items[0].Patient_Name);

                $('#select2-drPatient-container').text(items[0].Patient_Name);

                $('#PhoneNo').val(items[0].MobileNo)

                $('#Address').val(items[0].Address)

                $('#Age').val(items[0].Age)

                $('#Gender').val(items[0].Sex)

                $('#Address').val(items[0].Address)

            }

        }

    </script>

  • You might also like

    No comments :

    Post a Comment