JSON data to Timeline tool?

Posted on 2012-08-19
Last Modified: 2012-08-31
I'm working with a tool that uses JSON data.  Now I'm trying to feed it my own JSON data that I build as a string then try to convert to a JSON object.

Here's the tool.  Do a View-Source on the page to see how they're feeding it data:

I need to provide it data dynamically.  I can't embed the data on the page as they're doing.  I will need to return the timeline data from an ajax call to the server and somehow feed it to the timeline.

Of course, in their example, they're not returning a string from the server and trying to cast it into a JSON object.  It's already neatly ready to work perfectly, as a hard-coded JSON structure.

I've tried building a string that looks like *their* JSON data, then casting it to be a JSON list.  To that end, I've tried the jQuery string-to-JSON-object method, and I've tried just JSON.parse(str).  Everything returns NULL, so starting with a JSON-like string and "casting" it to a JSON data structure isn't working for me.

How can I feed dynamic JSON timeline data to this tool?

Question by:bamapie
    LVL 25

    Accepted Solution

    Have a look at this example I created using that example.  It uses a PHP script to get the data via an ajax call (sorry, I haven't learnt ASP yet).  The PHP script has the data hard-coded, but it could easily have been from a database table.
    Note: the paths to the timeline.js etc have been altered to use a different path.

    Author Comment

    Did you see my last couple of comments on the other question?  I graded it and awarded you points.  I really wanted to open this question up to others to answer.
    LVL 25

    Expert Comment

    OK ... I am sorry.  I do not want to stop others from answering too.  Please delete and re-open another if you would rather.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
    Hi all! Recently there was EE question and the person wanted to have a multi-column textbox <div> selection, so as a first step to answer I provided a link but that was not complete with JavaScript selection, but had a good style sheet. So as a ques…
    The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
    The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now