Paolo Pedrazzi Paolo Pedrazzi - 2 months ago 4
Ajax Question

Select only an array of dates Jquery datepicker

I have a

php array
that returns a available day of the week already converted in number this 1,2,5 for (Monday, Thursday, Friday).
Now i have function like this:

$(document).ready(function() {
minDate: 0,
beforeShowDay: function(date) {
var day = date.getDay();
return [(day != 1 && day != 2)];

But i have trouble to use it with the provided array. I need that days available is dynamically fetched from the array that I pass trough
var days = <?php echo $days; ?>


You could use json_encode to translate your php array to a javascript array, then do something like @arun-p-johny suggested

var days = (<php echo json_encode($array); ?>);
return [days.indexOf(day) !== -1]