Problems populating scheduler with ajax

Hi !!

Ive just started using DHTML scheduler but have run into some problems…
I try to populate the scheduler with ajax, but it wont render anything… Hope someone can help…

setup scheduler:
xml_date: “%Y-%m-%d %H:%i”,
date: new Date(2013, 7, 19),
first_hour: 8,
last_hour: 17,
mode: “week”

ajax function:
function GetSchemaSessions(id) {
url: “@Url.Content(”~/SkolePlanlegging/SessionSchema/GetSchemaSessions")",
type: ‘POST’,
data: { id: id },
success: function (data) {
scheduler.parse(data, “json”);
dataType: “text”

The data it returns looks ok, but nothing is showing… Return data looks like this:
[{“id”:“35be59c8-7905-4c3a-8286-cc05f0188357”,“start_date”:“2013-08-20 11:10”,“end_date”:“2013-08-20 13:10”,“text”:“Test”,“session_type”:“0”}
,{“id”:“3c1de3ca-b0c9-42ef-945c-12ed650f012c”,“start_date”:“2013-08-19 13:55”,“end_date”:“2013-08-19 14:40”,“text”:“Test”,“session_type”:“0”}
,{“id”:“2f63fdff-561a-4f0b-9274-5e156e4cb30c”,“start_date”:“2013-08-19 10:25”,“end_date”:“2013-08-19 11:45”,“text”:“Yalla”,“session_type”:“1”}

What am I doing wrong… Any ideas is appreciated… Thanx…


scheduler.parse expects an array of data items, which seems to be stored in the Data property of response object, try this: scheduler.parse(data.Data, "json");

Yes you are right, we had to fetch the .Data from the object.
But we also found out that we had to secure that the Json result was correctly sent from the controller, so we forced the jsonresult to look like this:
return Json(new {Data = calendarEvents}, JsonRequestBehavior.AllowGet);

In addition we also had to set the dataType to “json”, though a colleague of my has “text” and it works nicely on his machine…
So a combination of all three made things work in the end…