我有混合twig和jQuery的问题。我尝试实现fullcallendar。一切都在本地工作,但在远程服务器上失败。这是我的admin.html.twig的一部分:
<script>
$(document).ready(function() {
$('#calendar').fullCalendar({
timeFormat: 'HH:mm',
minTime: '08:00:00',
maxTime: '21:00:00',
defaultTimedEventDuration: '01:00:00',
header: {
left: 'prev,next',
center: 'title',
right: 'month, agendaWeek, agendaDay'
},
events: {% if calendarData is defined %}
{{ calendarData|json_encode|raw }}
{% else %}
null
{% endif %}
});
});
</script>
我可以在localhost上获取事件,但是在远程服务器上查看源代码&#39;显示了这个:
<script>
$(document).ready(function() {
$('#calendar').fullCalendar({
timeFormat: 'HH:mm',
minTime: '08:00:00',
maxTime: '21:00:00',
defaultTimedEventDuration: '01:00:00',
header: {
left: 'prev,next',
center: 'title',
right: 'month, agendaWeek, agendaDay'
},
events:
});
});
</script>
为什么?