$.ajax({
type: "POST",
contentType: "application/json",
data: "{eventdata:" + JSON.stringify(eventToSave) + "}",
url: "Business/DashboardCfc.cfc?method=funtodayevent&returnFormat=JSON",
dataType: "json",
success: function (data) {
var events = new Array();
$.map(data.d, function (item, i) {
var event = new Object();
event.id = item.Event_id;
event.start = new Date(item.even_date);
event.title = item.EventName;
event.allDay = false;
events.push(event);
})
$('div[id*=calendar]').fullCalendar('addEventSource', events);
$("#loading").dialog("close");
},
}
});
答案 0 :(得分:0)
The question is vague enough that all I can deduce from the title of the question is that the code isn't working for you. Here is what came out of my comments to your questions above:
$.ajax({
type: "POST",
contentType: "application/json",
data: "{eventdata:" + JSON.stringify(eventToSave) + "}",
url: "Business/DashboardCfc.cfc?method=funtodayevent&returnFormat=JSON",
dataType: "json",
success: function (data) {
var events = new Array();
$.map(data.d, function (item, i) {
var event = new Object();
event.id = item.Event_id;
event.start = new Date(item.even_date);
event.title = item.EventName;
event.allDay = false;
events.push(event);
});
$('div[id*=calendar]').fullCalendar('addEventSource', events);
$("#loading").dialog("close");
}
});
I would also advise to use $.map
in the correct manner if you are going to get the most benefit out of it.
var events = $.map(data.d, function (item, i) {
var event = new Object();
event.id = item.Event_id;
event.start = new Date(item.even_date);
event.title = item.EventName;
event.allDay = false;
return event;
});