I am making a kind of reservation page where you can reserve a location for a specific day, all the dates will be stored in a database for each location. But I want to get all the dates from the database and store them in a javascript array so I can disable these dates from the datepicker on the page. I know how to select the dates using php and mysql but I can't figure out a way to store the data in a javascript array.
This is the js code for the datepicker:
var disableddates = ["20-05-2015", "12-11-2014", "21-05-2015", "12-20-2014"];
function DisableSpecificDates(date) {
var string = jQuery.datepicker.formatDate('dd-mm-yy', date);
return [disableddates.indexOf(string) == -1];
}
$(function() {
$("#date1").datepicker({
beforeShowDay: DisableSpecificDates
});
});
I want the array to hold the dates from the database.