jquery - how to bind data to jqureyevent calendar using Ajax -
$.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"); }, } });
the question vague enough can deduce title of question code isn't working you. here came out of comments 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 advise use $.map
in correct manner if going 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; });
Comments
Post a Comment