我已经研究过了,但我无法让我的解决方案起作用。 我已经创建了我的休息服务来根据需要提供事件数据......
[
{"id":"cb2eb05b-7a24-431c-8948-d08fb51f6bab","title":"Happy Birthday Pat!","allDay":false,"start":"2017-12-30T03:00:00","end":"2017-12-31T02:30:00","url":""},
{"id":"89fdeab5-1f49-4416-b81c-d9d9a3c4fbde","title":"RailJam on Westway","allDay":false,"start":"2017-12-31T15:00:00","end":"2017-12-31T19:00:00","url":""},
{"id":"37afb0e6-e659-46a3-a048-5f13560ebe87","title":"Senior OEC Clinic","allDay":false,"start":"2018-01-07T11:00:00","end":"2018-01-07T19:00:00","url":""},
{"id":"6d74033c-39ce-4d43-b642-bceed34e2294","title":"Senior OEC Clinic","allDay":false,"start":"2018-01-21T11:00:00","end":"2018-01-21T19:00:00","url":""},
{"id":"36ca8f3b-6696-49f4-b7b7-a405660358e8","title":"Senior OEC Clinic","allDay":false,"start":"2018-01-28T11:00:00","end":"2018-01-28T19:00:00","url":""},
{"id":"3b1a86ec-d09a-467d-ad83-43864439db1f","title":"Senior OEC Clinic","allDay":false,"start":"2018-02-03T11:00:00","end":"2018-02-03T19:00:00","url":""}
]
我已经使用完整日历插件创建了我的 MVC 页面......
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<dynamic>" %>
<link href="../../FullCalendar/fullcalendar.css" rel="stylesheet" type="text/css" />
<script src="../../FullCalendar/lib/moment.min.js" type="text/javascript"></script>
<script src="../../FullCalendar/lib/jquery.min.js" type="text/javascript"></script>
<script src="../../FullCalendar/fullcalendar.min.js" type="text/javascript"></script>
<script>
$(document).ready(function () {
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,basicWeek,basicDay'
},
color: 'blue',
textColor: 'white',
events: 'http://localhost:3276/rest/bsp/events/'
});
});
</script>
<div id='calendar'></div>
但我仍然无法将我的活动发布在日历上。
完整日历中缺少事件
我敢肯定,这是我错过的一个简单的错误......谁能说出一些启示?
成功。我的结果被包装在HTML中,所以不是纯JSON。通过返回返回纯 JSON 字符串的流进行更正,而不是字符串的 HTML 表示形式。