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

197
Vistas
How to rerender fullcalendar and pass some data response from ajax

I am creating a booking calendar and ran into a problem. I can't render the full calendar after Ajax responses. In response, he receives two arrays with numbers, one array defines which days of the week are available, e.g. (1 and 6, i.e. from Monday to Saturday) - here I use the hiddendays function, but I cannot dynamically pass data to it. At the same time, in the second table I have specific dates that are no longer available, so I want to exclude them from clicking on them, but I do not know what function to use.

$(document).ready(function () {

    let startServiceDay = 0;
    let endServiceDay = 0;
    const calendarEl = document.getElementById("calendar");
    /* AJAX FULL CALENDAR */
    $("select#select-service").change(function () {
        $.ajax({
            headers: {
                'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
            },
            method: "POST",
            url: getFreeDay + $(this).val(),
            data: {
                "id": $(this).val()
            },

            beforeSend: function () {

                $(".calendary-loader").css('display', 'block');

            },

        })
            .done(function (data) {
                data:data.hiddenDays,
                    data.startServiceDay = data.hiddenDays[0]['service_day_of_week_start'],
                    data.endServiceDay = data.hiddenDays[0]['service_day_of_week_end'],
                    calendar.render();
                $(".calendary-loader").css('display', 'none');
                console.log(startServiceDay + ' ' + data.endServiceDay);
                //window.location.reload();
            })
            .fail(function (data) {
                console.log($(this).data('id'))
                console.log(data.responseJSON.message);
            });

    });


    let calendar = new Calendar(calendarEl, {
        //const m = moment();
        locale: plLocale,
        plugins: [dayGridPlugin, timeGridPlugin, listPlugin, interactionPlugin, momentPlugin],
        initialView: 'dayGridMonth',
        headerToolbar: {
            left: 'prev,next',
            center: 'title',
            right: ''
        },
        editable: true,
        hiddenDays: [startServiceDay, endServiceDay],
        /*dayRender: function(date, cell){
            if (date > maxDate){
                $(cell).addClass('disabled');
            }
        },*/
        selectable: true,
        selectAllow: function (select) {
            return moment().diff(select.start, 'days') <= 0
        }
    });
});
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