Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

396
Visualizações
Datepicker Enable Specific Days from list

I am trying to develop an appointment system. I tried to enable available dates in a date picker, but the problem is that it enables only one day.

$('#doctor').on('change', function() {
  var drId = this.value;
  $('#timetable').html('');
  
  $.ajax({
    url: '{{ route('
    getTimes ') }}?dr_id=' + drId,
    type: 'get',
    success: function(res) {
      console.log(res);
      
      $('#timetable').html('<option value="">Select Day Time</option>');
      
      $.each(res, function(key, value) {
        const weekday = [, "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Satarday"];
        const d = new Date();

        //Disabled by Day Name
        $(document).ready(function() {
          $('#datepicker').datepicker({
            beforeShowDay: filterDays
          });
        });

        // getDay() method returns the day of the week (from 0 to 6) where 
        // Sunday is 0, Monday is 1, and so on.
        function filterDays(date) {
          var day = date.getDay();
          //return true only if day is Wed or Fri or Sun
          return [day[value.day_name]]
        }

        $('#timetable').append('<option value="' + value.id + '">' + value.start_time + value.end_time + '</option>');
      });
    }
  });
});

Here return [day[value.day_name]] shows only Sunday, but there is another 3 days had stored in the database. It's passes only a single value.

Please help me to do this.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda