我是新来的查询,我对 fullcalendar ( http://arshaw.com/fullcalendar/ ) 有疑问。我想根据事件的类型为事件着色。
js:
$(document).ready(function () {
$('#fullcal').fullCalendar({
allDayDefault: false,
defaultView: 'agendaWeek',
eventSources: [
{
url: 'WS.asmx/GetSchedulerEvents',
type: 'POST',
data: {
taskType: 'TODO'
},
color: 'red',
textColor: 'black'
},
{
url: 'WS.asmx/GetSchedulerEvents',
type: 'POST',
data: {
taskType: 'COMPLETED'
},
color: 'blue',
textColor: 'white'
}
]
})
});
网络服务方法:
[WebMethod]
public List<SchedulerEvent> GetSchedulerEvents(string taskType)
{
List<SchedulerEvent> events = new List<SchedulerEvent>();
if (taskType == "TODO")
{
events.Add(new SchedulerEvent(
2,
"EventName 1",
new DateTime(2013, 05, 20, 10, 00, 00).ToString(),
new DateTime(2013, 05, 20, 10, 00, 00).AddHours(4).ToString()
));
}
else if (taskType == "COMPLETED")
{
events.Add(new SchedulerEvent(
1,
"EventName 2",
new DateTime(2013, 05, 21, 11, 00, 00).ToString(),
new DateTime(2013, 05, 21, 11, 00, 00).AddHours(3).ToString()
));
}
return events;
}
要求:
taskType=TODO&start=1368914400&end=1369519200
and
taskType=COMPLETED&start=1368914400&end=1369519200
回复:
<?xml version="1.0" encoding="utf-8"?>
<ArrayOfSchedulerEvent xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.org/">
<SchedulerEvent>
<EventId>1</EventId>
<EventName>EventName 2</EventName>
<StartDate>2013-05-21 11:00:00</StartDate>
<EndDate>2013-05-21 14:00:00</EndDate>
</SchedulerEvent>
</ArrayOfSchedulerEvent>
and
<?xml version="1.0" encoding="utf-8"?>
<ArrayOfSchedulerEvent xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.org/">
<SchedulerEvent>
<EventId>2</EventId>
<EventName>EventName 1</EventName>
<StartDate>2013-05-20 10:00:00</StartDate>
<EndDate>2013-05-20 14:00:00</EndDate>
</SchedulerEvent>
</ArrayOfSchedulerEvent>
我的问题是:为什么请求和响应不是 json 格式?
谢谢