当发现特殊字符时,FullCalendar停止加载

时间:2019-01-19 06:25:02

标签: javascript jquery fullcalendar

当我添加标题(例如我的生日日历)时,停止加载

这是我的脚本:

$('#calendar').fullCalendar({
    header: {
        left: 'prev,next today',
        center: 'title',
        right: 'month,basicWeek,basicDay,listMonth'
    },
    weekNumbers: true,
    editable: true,
    eventLimit: true, // allow "more" link when too many events
    selectable: true,
    selectHelper: true,
    //Select function
    //Event render
    //Event drop
    //Event resize
    events: [
    <?php foreach($events as $event): 
       //Fetch data dynamically
       title: '<?php echo $event['title']; ?>',
    <?php endforeach; ?>
    ]
});

我该怎么办?

1 个答案:

答案 0 :(得分:1)

是的,因为单引号似乎结束了您的字符串。您应该尝试转义特殊字符。您可以尝试以下方法:

title : 'my\'s Birthday'

OR

title : "my's Birthday"

OR

title : 'my&quot;s Birthday'