Reputation: 8079
I am trying setting up the Fullcalendar JQuery plugin with a JSON feed. It is not working, so I tried with the provided example with the plugin, and it works with that, so it is clearly a problem with my feed.
Here is the output of the example JSON feed (which works):
And here, the output of my JSON feed, which is not working:
Can anyone see anything wrong with the syntax?
The output worked when I printed it inside the .js config with PHP (well, I only changed one things after it wouldnt work: i put quotes on the property names), so I think the data is good...
EDIT: fixed second link
Upvotes: 0
Views: 254
Reputation: 20091
Run your invalid JSON through a validator like JSONLint. It might be quicker than asking people to hand-validate your output.
Updated:
It is easier to work with small sets of data at first than large. You have a couple of problems with your JSON:
Here is a sample of valid JSON using your data:
[
{
"title": "1",
"start": "2011-01-01",
"className": "ottype1"
},
{
"title": "2",
"start": "2011-01-02",
"className": "ottype1"
}
]
If you are creating your JSON by hand (which appears to be the case"), find a library to create your JSON for you.
Upvotes: 1
Reputation: 9841
This is your JSON
, 'start': new Date ('2011-01-01'),
this is the example JSON
,"start":"2011-06-10",
The date formatting is very very very very very very very... buggy.But- the newest version is supposed to be more relaxed.
This is a quote directly from the Documentation.
http://arshaw.com/fullcalendar/docs/event_data/Event_Object/
start Date. Required.
The date/time an event begins.
When specifying Event Objects for events or eventSources, you may specify a string in IETF format (ex: "Wed, 18 Oct 2009 13:00:00 EST"), a string in ISO8601 format (ex: "2009-11-05T13:15:30Z") or a UNIX timestamp.
And here is a very complex JSON from my site the beggining..
[{"title":"Tee Times","start":"2011-06-30T00:00:00","end":"2011-06-30T00:00:00","allDay":true,"color":"rgb(21,144,51)","groupsize":"","className":"data-brs clickable","cache":null,"EventName":null,"description":null,"EventCompTypeMSP":null,"url":null,"ID":null,"ID2":null,"CompName":null,"CompCourseName":null,"CompNumberDivs":null,"CompQualifierYN":null,"CompNumber":null},{"title":"Test","start":"2011
.. carries on for pages and end
ompetitions.aspx?compID=1088909","ID":40,"ID2":1088909,"CompName":"March Medal","CompCourseName":"Red Tee's","CompNumberDivs":1,"CompQualifierYN":"Y","CompNumber":40}]
Upvotes: 1