json feed from cfc file not displaying in FullCalendar

87 views Asked by At

I am trying to pass events into FullCalendar using json and they are not displaying. Does anyone know if there is something wrong with the structure of my json?

CFC file:

<cfcomponent>
    <cfsetting showDebugOutput='No'>
    <cffunction access='remote' name='getEvents' >

        <cfset var events = [{'id'='10','title'='Urlaub','start'='2014-11-14 07:30:30','end'='2014-11-14 08:30:30'}]>

    <cfreturn serializeJSON(events)>

    </cffunction>
</cfcomponent>

CFM file:

eventSources:
        [
            {
                url: 'events_for_calendar_test.cfc?method=getEvents',
                color: 'yellow',
                textColor: 'black'
            }
        ]

JSON feed being passed:

[{"start":"2014-11-14 07:30:30","end":"2014-11-14 08:30:30","id":"10","title":"Urlaub"}]

1

There are 1 answers

2
tdh On BEST ANSWER

wddxpacket was being added to the json by coldfusion serializeJSON. just had to add attributes to the function to make sure it only returned what I needed.

<cfcomponent>
<cfsetting showDebugOutput='No'>
<cffunction access='remote' name='getEvents' returnformat="JSON" returntype="String">
    <cfset var events = [{'id'='10','title'='Urlaub','start'='2014-11-14','end'='2014-11-14'}]>
    <cfreturn serializeJSON(events)>
</cffunction>