I am stuck in JQuery Calendar
i have a drop down who have list of cities
<select name="flyto_code" id="flyto_code">
<option value="ISB">Islamabad (ISB)</option>
<option value="KHI">Karachi (KHI)</option>
</select>
and i have dynamic (came from ajax) array filled with the dates like..
var availableDatesForKhi = ["12-10-2013","13-10-2013","14-10-2013","15-10-2013","16-10-2013","17-10-2013","18-10-2013"];
var availableDatesForIsb = ["12-11-2013","13-10-2013","14-11-2013","15-10-2013","16-11-2013","17-10-2013","18-11-2013"];
when i select KHI from dropbox DatePicker should enable availableDatesForKhi
$( "#departure_date" ).datepicker({
beforeShowDay: available,
numberOfMonths:1,
showWeek: true,
dateFormat: 'dd-mm-yy',
showAnim: "slideDown",
onClose: function( selectedDate )
{
$( "#return_date" ).datepicker( "option", "minDate", selectedDate );
}
});
function available(date)
{
dmy = date.getDate() + "-" + (date.getMonth()+1) + "-" + date.getFullYear();
if($.inArray(dmy, availableDatesForKhi ) != -1)
{
return [true, "","Available"];
}
else
{
return [false,"","unAvailable"];
}
}
how do i call & create a function