?
Solved

JSON data to Timeline tool?

Posted on 2012-08-19
3
Medium Priority
?
1,040 Views
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:

http://links.sourceforge.net/timeline/js/examples/example17_json_data.html

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?

Thanks
0
Comment
Question by:bamapie
  • 2
3 Comments
 
LVL 25

Accepted Solution

by:
lwadwell earned 2000 total points
ID: 38310396
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.
example17-json-data.html
getdata.php
0
 

Author Comment

by:bamapie
ID: 38311580
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.
0
 
LVL 25

Expert Comment

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

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…
The viewer will learn how to dynamically set the form action using jQuery.
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…
Suggested Courses
Course of the Month15 days, 16 hours left to enroll

850 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