可能重复:
Can the jQuery UI Datepicker be made to disable Saturdays and Sundays (and holidays)?
我将从数据库中获取一组日期。我必须只启用jQuery日历中的那些日期。我该怎么办?
答案 0 :(得分:1)
答案 1 :(得分:0)
你可以使用这个jQuery插件,它使用jQuery-UI的日期选择器
http://balupton.com/sandbox/jquery-sparkle/demo/#eventcalendar
只需查询数据库并以此格式返回JSON对象
{
"entries": [
{
"id": 1,
"title": "My First Entry",
"start": "2010-07-14 11:11:00",
"finish": "2010-07-14 14:23:18",
"user": {
"name": "Joe"
}
},
{
"id": 2,
"title": "My Second Entry",
"start": "2010-07-14 11:11:00",
"finish": "2010-07-15 14:23:18",
"user": {
"name": "Joe"
}
}
]
}
然后只需将其添加为插件的选项:
$eventCal.EventCalendar({
// Ajax Variables
/** The JSON variable that will be return on the AJAX request which will contain our entries */
ajaxEntriesVariable: 'entries',
/** The AJAX url to request for our entries */
ajaxEntriesUrl: './eventcalendar.json'
});