i'm trying to pass the data i got from the function initiated by onChangeMonthYear to the function initiated by beforeShowDay. I tried various methods, like assigning the data I got from test.php to a variable declared at the outside but to no avail. so what i did was just update a text field with the retrieved data from test.php, and asks the function in beforeShowDay to get the data from there. here's a portion of my code
$(document).ready(function() {
$('#datepicker').datepicker({dateFormat: 'dd-mm-yy', currentText: 'Now', changeMonth: true, changeYear: true, altField: '#alternate', altFormat: 'DD, d MM, yy', onSelect: function(dateText, inst) {},
onChangeMonthYear: function(year,month,inst){
$.post("test.php", {action: "TEST", month: month, year: year},
function (data){
$("#datafromphp").val(data);
}
,"html");
},
beforeShowDay: function (date){
var getdatafromphp= $("#datafromphp").val();
}
});
});
surely there's a better way to do this?