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

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -