私は gldatepicker を使用しています。曜日、特別な日付などの gldatepicker の ajax によってデータベースからいくつかの設定をロードしたいのですが、これには次の js コードがあります。
$(document).ready(function () {
    loadAllSettings();
});
var loadAllSettings = function () {
    startDate = '';
    endDate = '';
    selectDay = '';
    offdays = '';
    $.ajax({
        url: "bs_client_function.php",
        type: "post",
        dataType: "json",
        data: {
            action: 'getDateRange'
        },
        success: function (html) {
            // alert(html.start);
            startDate = Date.parse(html.start);
            endDate = Date.parse(html.end);
        }
    });
    $.ajax({
        url: "bs_client_function.php",
        type: "post",
        dataType: "json",
        data: {
            action: 'getOffdays'
        },
        success: function (html) {
            i = 0;
            offdays = '[';
            while (i < html.length) {
                offdays = offdays + {
                    date: new Date(html[i]),
                    repeatYear: false,
                    cssClass: 'noday'
                };
                i = i + 1;
            }
            offdays = offdays + ']';
        }
    });
    $.ajax({
        url: "bs_client_function.php",
        type: "post",
        data: {
            action: 'getDays'
        },
        success: function (html) {
            var data = $.parseJSON(html);
            // alert("[" + data + "]");
            selectDay = '[' + data + ']';
            // alert(selectDay);
           showCalender(startDate, endDate, selectDay, offdays);
        }
    });
    alert(selectDay);
    console.log('selectDay' + selectDay);
};
gldatepicker が推奨するように、すべてのデータが正しくフォーマットされていることを確認しました。
var showCalender = function (startDate, endDate, selectDay, offdays) {
    var dd = $('#mydate').glDatePicker({
        showAlways: true,
        allowMonthSelect: true,
        allowYearSelect: false,
        prevArrow: '\u25c4',
        nextArrow: '\u25ba',
        cssName: 'darkneon',
        selectableDOW: selectDay,
        dowOffset: 0,
        selectedDate: new Date(),
        selectableDateRange: [{
            from: new Date(startDate),
            to: new Date(endDate)
        }, ],
        specialDates: offdays
    });
};
現在、stardate と enddate のみが正しく機能しています。selectDay、offdays は機能していません。私はコンソールに selectDay を印刷します: [1,2,3] しかし、それは動作していません。 前もって感謝します...