select day and special date load by ajax to set in gldatepicker
<p>I am using gldatepicker.I want to load some settings from database by ajax for gldatepicker such as day of week,special date etc.Now i have following js code for this:</p>

<pre><code>$(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 &lt; 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);

};
</code></pre>

<p>I have checked all data is correctlly formated as gldatepicker recommanded.In my show calender
function:</p>

<pre><code>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
    });
};
</code></pre>

<p>Now only  stardate and enddate rightly working.selectDay,offdays are not working. i print selectDay in the console i got this: [1,2,3] but it not woking.What i am missing or what should be right way to do it. 
    <strong>Thanks in advance...</strong></p>
