Help with asynchronous request script

0

This form will have the purpose of scheduling for consultation, with the client selecting the desired professional, and having a calendar with the weekly days selectable for attendance.

For example:

Dr. Rogério serves from Monday to Saturday.

Dr. Ludmila attends only the 3rd and 5th

So far everything is working.

My problem is in the exchange (in a new selection) of the professionals.

When I select Dr. Ludmila and view her attendance calendar, but when I try to change it to Dr. Rogério's calendar by making a new professional selection, he keeps bringing me the schedule of Dr. Ludmila.

I can only change the calendar giving an update on the page, and redo the whole procedure and selecting Dr. Rogerio to load your calendar

I put this temporary address to view the problem, with a link to Download the used files.

If your friends can give me a light, how can I change the calendars by selecting the professional without having to reload the page, I'll be very grateful.

Thanks in advance for your attention.

    
asked by anonymous 11.12.2017 / 15:51

1 answer

1

Inside your calendar.php file Add the following line $("#datepicker").datepicker("destroy");

Your code will look like this

<script>
    $(document).ready(function(){
            $("#datepicker").datepicker("destroy");
            $("#datepicker").datepicker({
                beforeShowDay:function(date)
            {
            var day = date.getDay();
            var month = date.getMonth();
            var currDate = date.getDate();
            '.$datepicker['formato_calendario'].'
            {return [false];}
            else
            return [true];

        }});
    });
</script>

What is happening is that you already have an instance of the datapicker and you are trying to add another, but for this you need to destroy the current

    
11.12.2017 / 16:57