fullcalendar - Full Calendar static eventSources -


i using fullcalendar eventsources pull json event data server. have variable sheet_id changes , selected_sheet_id() function return corresponding sheet selected. problem when call $("#calendar").fullcalendar('refetchevents') return events, sheet_id (thus events) same. fullcalendar not refreshed current sheet_id before fetching events. how trigger eventsources "recompile" pulls correct sheet_id function before executing ajax call.

eventsources: [{     url: '/event/get_events',     type: 'get',     data: {         sheet_id: selected_sheet_id()     },     error: function() {         alert('there error while fetching events!');     }      }] 

first try async:false sync call :

eventsources: [           {            url: '/event/get_events',            type: 'get',            async:false,            data:{                   sheet_id: selected_sheet_id()                 },            error: function() {               alert('there error while fetching events!');               },                 },              ] 

otherwise made 1 method fetch event data in using ajax call ex :

  var ajaxreturnstring="";        $.ajax({               type: "post",               url: "/emr-phr/getpatientscheduleajax.html",             datatype:"html",             data: "",            async:false,             success: function(data){                 ajaxreturnstring=$.trim(data);                  var obj = eval("("+txt+")");                      return obj;             },               error: function(e){                 alert('error: ' + e);               }             });       } 

Comments