I have a JSON file like this
[{"excursionDay":"2"},{"excursionDay":"3"},{"excursionDay":"4"}]
I want to pass the value of excursionDay into an array in javascript like this
dayValues = [2,3,4]
My javascript code so far is the following
fucntion excursionDates(date){
var day = date.getDay();
var dayValues = [];
$.get('json.php',function(data){
for(var i=0; i<data.length;i++){
dayValues.push(data[i].excursionDay);
}
},'json');
}
But for some reason i can't get this work. All of the above i want to triggered when i click in a jquery-ui datepicker and enable only the specific days. The code for the datepicker is bollow.
$("#excursionDate").datepicker({
minDate: today,
dateFormat: 'dd-mm-yy',
beforeShowDay: excursionDates
});
Can anyone help me out please?