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

204
Visualizações
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 à 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