When I click on `dateFrom` calendar, I need to pass `data-id` to server and fetch some date from database. If any date response, I need to mark red color and not select that date on calendar. 

At-present when I click `data-id` is passing to server and getting response correctly. But I don't know how that response get in `datepicker()` and mark as disable date in calendar. Any help will be appreciated. Thank you

[![Please check this image](https://i.stack.imgur.com/Xde19.jpg)](https://i.stack.imgur.com/Xde19.jpg)

**Style**

```
<style>
    .markholiday .ui-state-default
    {
        color: red;
    }
</style>

```

**html**

```
<div class="form-group row calendar" data-id="5799f281049ac12422000033">
         <div class="col-sm-4">
             <input type="text" class="form-control dateFrom hasDatepicker" id="dateFrom" name="dateFrom" placeholder="Arrival" readonly="">
         </div>
         <div class="col-sm-4">
             <input type="text" class="form-control dateTo hasDatepicker" id="dateTo" name="dateTo" placeholder="Departure" readonly="">
         </div>
    </div>

<div class="form-group row calendar" data-id="5799f281049ac12422000034">
         <div class="col-sm-4">
             <input type="text" class="form-control dateFrom hasDatepicker" id="dateFrom" name="dateFrom" placeholder="Arrival" readonly="">
         </div>
         <div class="col-sm-4">
             <input type="text" class="form-control dateTo hasDatepicker" id="dateTo" name="dateTo" placeholder="Departure" readonly="">
         </div>
    </div>

<div class="form-group row calendar" data-id="5799f281049ac12422000035">
         <div class="col-sm-4">
             <input type="text" class="form-control dateFrom hasDatepicker" id="dateFrom" name="dateFrom" placeholder="Arrival" readonly="">
         </div>
         <div class="col-sm-4">
             <input type="text" class="form-control dateTo hasDatepicker" id="dateTo" name="dateTo" placeholder="Departure" readonly="">
         </div>
    </div>

```

**Script**

```
$( ".dateFrom" ).on('click', function(){
                var dataId  = $(this).parent().parent().data("id");
                $.ajax({
                    url: '/calendar',
                    dataType: 'JSON',
                    type: 'POST',
                    data: { dataId: dataId },
                    success : function(response) {
                        var data  = response.disableDates; //["2018-01-31", "2018-02-20"];
                    }
                });
            });

            var array  = data // here data is not getting  
            $( ".dateFrom" ).datepicker({
                            dateFormat: "dd.mm.y",
                            beforeShowDay: function (date) {
                                var string = jQuery.datepicker.formatDate('yy-mm-dd', date);
                                return [true, (array.indexOf(string) == -1) ? "" : "markholiday"];
                            }
                        });

```

**Controller**

```
$seasons           = Season::where('cabin_id', $request->dataId)->get();
// after some process I am getting result
return response()->json(['disableDates' => $disableDates], 200); //["2018-01-31", "2018-02-20"]

```