Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

390
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda