Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

206
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!