$(document).ready(function () {
	$('#DivOtherDistrict').hide();  
	$('#DivOtherFaculity').hide();
    $('#state').change(function () {
       var state_id = $('#state').val();
       $(document).find('#districts').val(''); 
       
       if (state_id != '') {
          $.ajax({
             url: BASE_URL+"user/fetch_district",
             method: "POST",
             data: {
                state_id: state_id
             },
             dataType:'json',
             success: function (data) {
                var  html;
                  if(data.length > 0){
                      html  = data.map((item) => {
                        return `<option value="${item.id}">${item.name}</option>`;
                     })
                  }else{
                     html = '<option value="">Select District</option>';
                  }
               // console.log(html);
               html = Array.isArray(html) ? ['<option value="">Select District</option>',...html,'<option value="0">Other</option>'] : html;
                $('#district').html(html);
			
             }
          });
       } else {
          $('#district').html('<option value="">Select City</option>');
       }
    });

$('#district').change(function () {
	var district_id = $('#district').val();
	if ( district_id == '0')
	{
		$('#DivOtherDistrict').show();
	}
	else {
		$('#DivOtherDistrict').hide();
	}
	
	}); 

$('#facility').change(function () {
	var facility_id = $('#facility').val();
	if ( facility_id == '10')
	{
		$('#DivOtherFaculity').show();
	}
	else {
		$('#DivOtherFaculity').hide();
	}
	
	}); 
   /* $('#district').change(function () {
      var district_id = $('#district').val();
      $(document).find('#talukas').val(''); 
      
      if (district_id != '') {
         $.ajax({
            url: BASE_URL+"user/fetch_Taluka",
            method: "POST",
            data: {
               district_id: district_id
            },
            dataType:'json',
            success: function (data) {
               var  html;
                 if(data.length > 0){
                     html  = data.map((item) => {
                       return `<option value="${item.Id}">${item.name}</option>`;
                    })
                 }else{
                    html = '<option value="">Select Taluka/Block</option>';
                 }
              // console.log(html);
              html = Array.isArray(html) ? ['<option value="">Select Taluka/Block</option>',...html] : html;
               $('#taluka').html(html);
            }
         });
      } else {
         $('#taluka').html('<option value="">Select District</option>');
      }
   });  */

 });