UI datepicker
UI datepicker
hello,
I have some problems with the datepicker
Basically I have a table called unavailabilities with a date field.
I want to do two things. when I click on a date in the calendar, I
want it to send an ajax call so that the server code writes a record
in the database. when it's clicked again it removes the record.
that's fine. but the problem is I want the calendar cell clicked to
add a new css class and when it's clicked again, it removes it. I'm
not sure how to do that.
second problem is that I want it the calendar to show the
unavailabilities when it loads. I'm using a beforeShowDay callback
something like:
function setupBookings(date) {
jQuery.getJSON("/admin/unavailabilities/json/2",
function(data){
// ???
// needs to return a css class
// return [true, 'cal_booked'];
});
// return a normal class
// return [true, ''];
}
getJson has a callback but setupBookings needs to return results.
getJSon returns before the network call returns.
so I'm not sure how to hand the data to setupBookings so it can do the
logic
any ideas ?
Thanks