gpt4 book ai didi

javascript - Fullcalendar JS 中的 Ajax 调用事件点击

转载 作者:行者123 更新时间:2023-11-28 19:09:20 25 4
gpt4 key购买 nike

我正在开发Full Calender,我创建了四个事件Falahar、蛇、沙拉和午餐,如下:

<script>

$(document).ready(function() {

$('#calendar').fullCalendar({
defaultDate: '2015-06-16',
editable: true,
eventLimit: true, // allow "more" link when too many events
events: [
{
title: 'Falahar',
start: '2015-06-18'
},
{
title: 'Salad',
start: '2015-06-18'
},
{
title: 'Lunch',
start: '2015-06-18'
},
{
title: 'Snacks',
start: '2015-06-18'
},
]
});

});

</script>

这四个事件显示在日历上,现在我想要的是

When I click on any event then I want to call an AJAX which alerts the name of this event

我该如何执行它?

最佳答案

您可以使用 eventClick fullcalendar 选项

$('#calendar').fullCalendar({
defaultDate: '2015-06-16',
editable: true,
eventLimit: true, // allow "more" link when too many events
events: [
{
title: 'Falahar',
start: '2015-06-18'
},
{
title: 'Salad',
start: '2015-06-18'
},
{
title: 'Lunch',
start: '2015-06-18'
},
{
title: 'Snacks',
start: '2015-06-18'
},
],
eventClick:function(event){
//do the ajax call
}

});

关于javascript - Fullcalendar JS 中的 Ajax 调用事件点击,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31018327/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com