Question

When I try to load a Simile Timeline with data from the server I get this message:

Failed to load json data from 
{"events":
[{
"description":"Oswald moves to New Orleans, and finds employment at the William B. Riley Coffee Company.",
"end":"Wed May 01 1969 00:00:00 GMT-0600",
"isDuration":true,
"start":"Wed May 01 1963 00:00:00 GMT-0600",
"title":"Oswald moves to New Orleans"}]}
Bad Request

I think the data looks correct.

Here's the code that fires the request:

$(document).ready(function () {
        $.ajax({
            url: "http://localhost:64510/api/timeline",
            type: "GET",
            dataType: "json",
            contentType: "application/json",
            success: function (data) {
                loadTimeLine(data);
            }
        });

    });

function loadTimeLine(data) {

        var eventSource = new Timeline.DefaultEventSource();
        var bandInfos = [
            Timeline.createBandInfo({
                eventSource: eventSource,
                date: "Jun 28 2006 00:00:00 GMT",
                width: "70%",
                intervalUnit: Timeline.DateTime.MONTH,
                intervalPixels: 100
            }),
            Timeline.createBandInfo({
                eventSource: eventSource,
                date: "Jun 28 2006 00:00:00 GMT",
                width: "30%",
                intervalUnit: Timeline.DateTime.YEAR,
                intervalPixels: 200
            })
        ];
        bandInfos[1].syncWith = 0;
        bandInfos[1].highlight = true;


        tl = Timeline.create(document.getElementById("my-timeline"), bandInfos);

        Timeline.loadJSON(JSON.stringify(data), function (xml, url) { eventSource.loadJSON(xml, url); });

    }
Was it helpful?

Solution

The solution was that you have to add the status code 200 when creating the response from the server.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top