我需要在AJAX調用完成後將事件呈現爲HTML表格。成功時,我得到表格HTMLS。但是當它在標題中呈現時,它會將表格HTMLS顯示爲普通文本。當我GOOGLE了它,我發現我需要使用下面的代碼,以使其作爲HTMLS的解決方案:在fullcalendar.js事件中呈現HTMLS標記
eventRender: function (event, element) {
element.find('span.fc-event-title').html(element.find('span.fc-event-title').text());
});
但是,當我把它放在我的代碼,它顯示了一些JS錯誤。我不知道爲什麼這個錯誤正在發生。請幫我弄清楚。請從下面的代碼的全斷面:
dayClick: function(start,allDay, jsEvent, view) {
$('#calendar').fullCalendar('changeView', 'agendaDay');
var date_clicked = $.fullCalendar.formatDate(start, "yyyy/MM/dd");
var date_for_view = Date.parse(date_clicked);
var date_for_view=new Date(date_for_view);
$('#calendar').fullCalendar('gotoDate',date_for_view);
$.ajax({
url: "/admins/users/update_projects?date_selected="+date_clicked+"&uid="+'<%=params[:user]%>',
type: 'GET',
success: function (data, response, event, date) {
$('#calendar').fullCalendar('renderEvent',
{
title: data,
start: start
},
eventRender: function (event, element)
{
element.find('span.fc-event-title').html(element.find('span.fc-event-title').text());
}); },
error: function() {
$('#calendar').fullCalendar('renderEvent',
{
title: "No Tasks Scheduled Today",
start: date_clicked
});
}
});
},
上面編輯的代碼顯示錯誤的「錯誤:參數列表 源代碼後失蹤):SyntaxError錯誤 eventRender:函數(事件,元素)」 – rubyist