text: 
  function setLocation(id){
  
      $('#doctors_select').empty();
  
      $.ajax({
         dataType:'json',
         url:'/get-doctors/'+id,
          success: function (data,status,xhr) {   // success callback function
              var html = '';
             for(var i=0;i<data.length;i++){
                 html += '<option value="'+data[i].doc_id+'">'+data[i].fname+'</option>';
                 console.log(html);
             }
             $('#doctors_select').append(html);
  
          },
          error: function (jqXhr, textStatus, errorMessage) { // error callback
              console.log("Error is ",errorMessage);
          }
      });
  
  }
  
  function setDoctor(id){
      // $('#selected_doctor').attr('data-value',id);
      $('#selected_doctor_id').val(id);
  }
  
  function selectedDate(value,route){
      var doc_id = $('#selected_doctor').attr('data-value');
  
      $('#date').html('');
      var date = value;
      var d=date.split("-");
      var year=d[0];
      var month=d[1];
      var day=d[2];
      var comfD=month+'/'+day+'/'+year+' ,';
      $('#date').append(comfD);
      $.ajax({
          url:route,
          type: 'GET',
          data: { date: value,doctor_id:doc_id} ,
          success:function(data){
  
  
              // console.log(data[1].doc);
              var html = '';
              var one_column = 9;
              $('#doctor_slots').empty();
  
              if(data.length == 0){
                  $('#no_slots').css('display',"block");
                  setDoctor(0);
                  return;
              }
              else{
                  setDoctor(data[1].doc);
              }
  
  
              for(var i=0;i<data.length;i++){
                  var btn_class = data[i].str?"cmn-btn":"cmn-btn-available";
                  var data_val =  data[i].str? '':data[i].start;
                  console.log(btn_class);
                  if(i >= 9){
                      btn_class += ' display-bl';
                  }
                  html += ' <a href="javascript:void(0)" id="time_slot_'+i+'" onclick="show_more_menu('+i+');" class="'+btn_class+' available-time  active-time available" data-value="'+data_val+'"><span>'+data[i].start+'</span></a>'
              }
              html += ' <a href="javascript:void(0)" id="append_data_btn" onclick="appendData('+data.length+')" class="cmn-btn available-time  active-time available" data-value=""><span>Show More</span></a>'
  
              $('#doctor_slots').append(html);
          }
      });
  }
  
  
  function submitForm(form,route,tabName,event,id,current_id,thankyou_route = ''){
      let data = new FormData(form);
  
      $.ajax({
      url:route,
      type: 'POST',
      data: data,
      contentType:false,
      cache: false,
      processData:false,
      success:function(data){
          console.log(data.success);
  
          if(data.success){
              console.log($('#'+id));
              $('#'+id).addClass('active');
              $('#'+current_id).removeClass('active');
              if(thankyou_route == ''){
              window.scrollTo(0, 0);
              openCity(event, tabName)
              }
              else{
                  window.location.replace(thankyou_route);
              }
  
          }
  
       },
      error:function(err){
          $(".error-class").remove();
          showErrorMsgs(err);
       }
      });
  
  }
  
  
  
  function show_more_menu(id){
      var time_id ="#time_slot_"+id;
      var previous_selected = $('#previous_time_slot').attr('data-value');
      $('#previous_time_slot').attr('data-value',time_id);
      $(time_id).removeClass("cmn-btn-available");
      $(time_id).addClass("cmn-btn-selected");
      $(previous_selected).removeClass('cmn-btn-selected');
      $(previous_selected).addClass('cmn-btn-available');
  
  }
  
  function appendData(length){
      let prev = $('#show-more-selection').attr('data-value');
      let next_col = length-parseInt(prev) > 9? 9 :length-parseInt(prev);
      let next = parseInt(prev) + next_col;
      $('#show-more-selection').attr('data-value',next.toString());
      console.log(next < length);
      if(next <= length){
          for(let i=parseInt(prev);i<next;i++){
              console.log(i);
              let id = '#time_slot_'+i;
              $(id).removeClass('display-bl');
          }
      }
  
      console.log(next);
  }
  
  function  showErrorMsgs(errs) {
      var response = errs.responseJSON;
      $.each(response.errors, function (key, value) {
          let msg = value[0].replace(" id", "");
          key = key.replace(/\./g, '_');
          console.log(key);
  
          if($("#" + key+"_error").length == 0) {
           //   $("#" + key).parent().append('<div class="invalid-feedback" id= "'+key+'_error">'+ msg +'</div>');
              $("#" + key).parent().append('<div class="text-danger error-class" id= "'+key+'_error">This Field is required</div>');
  
          }
  
      });
  }
  
  