Abhishek
Abhishek

Reputation: 1031

Using Jquery Mobile to display charts(d3js) on mobile

I am using Jquery Mobile to create a HTML5 Mobile Application which would be able to display charts which are created using d3js. These charts would be created on client side, however the data would be retrieved via server. The JQM pages are static HTML pages which would request data from server and create impromptu charts. However, I am having difficulty in understanding JQM ajax/hash mapping. When I redirect a request to another page it is unable to run javascript on that page. Hence I have used window.location.href = a.html to change pages instead of $.mobile.changePage(a.html).

Each data page has an id so that it can be cached, how can I then create a new page link and feed it data.

I have 2 files : index.html which contains list of data which a user can choose to see and then another file which is chart.html which contains information on how to create a chart using Javascript Ajax to fetch data from server. How is this possible using JQM.

Upvotes: 0

Views: 823

Answers (1)

Nirmal Patel
Nirmal Patel

Reputation: 5168

I hope you have already run through JQM Page Links and JQM Page Scripting

Since JQM fetches all subsequent pages via (Hi)Ajax and inserts their <body> tag into the current DOM; the <script>s defined on your subsequent pages are not executed.

You will need to include all your scripts in the <head> of your first page - index.html

For passing parameters between pages; you could simply use the plugins mentioned at the bottom of the JQM Page Scripting page

Although I personally just use the $.data() function :D

Upvotes: 1

Related Questions