我正在使用jquery fullcalendar来显示事件。我需要做的是将通过ajax调用返回的文本转换为json对象,然后使用$('#calendar').Fullcalendar('addEventSource', json object)
。返回的文本如下:
[
{"id":"1","title":"ECNG 1015nENG4nK. John","start":"8:00 am","end":"10:00 am","allDay":false},
{"id":"2","title":"ECNG 1016nENG7nP. Weiss","start":"1:00 pm","end":"2:00 pm","allDay":false},
{"id":"3","title":"ECNG 2017nENG6nK. John","start":"10:00 am","end":"12:00 pm","allDay":false},
{"id":"4","title":"ECNG 1018nENG6nF. Philbert","start":"4:00 pm","end":"5:00 pm","allDay":false},
{"id":"5","title":"ECNG 1019nLT4nJ. Jerremy","start":"2:00 pm","end":"4:00 pm","allDay":false},
{"id":"6","title":"ECNG 1020nLT4nV. Victor","start":"5:00 pm","end":"7:00 pm","allDay":false},
{"id":"7","title":"ECNG 1019nLT4nJ. Jerremy","start":"1:00 pm","end":"3:00 pm","allDay":false},
{"id":"8","title":"ECNG 1017nENG5nL. Lawrence","start":"9:00 am","end":"10:00 am","allDay":false},
{"id":"9","title":"ECNG 2017nENG6nK. John","start":"10:00 am","end":"12:00 pm","allDay":false}
]
它是从PHP中的多维数组中编码的。我没有把这个文本转换成json对象的运气。有人能提出解决方案吗?
我建议尝试JSON.simple