简体   繁体   English

在JQuery的HTML5页面之间传递参数

[英]Passing parameters between HTML5 pages in JQuery

Here is the situation: 情况如下:

I have a HTML5 demo application. 我有一个HTML5演示应用程序。 My database is an external JSON file. 我的数据库是一个外部JSON文件。 In the first page (soon after log in) the data is read from the JSON through GetJSON command and rendered into an interactive graph. 在第一页(登录后不久),通过GetJSON命令从JSON读取数据并将其呈现为交互式图形。

The user's choice of data is captured in an integer array which saves the primary key of each chosen item. 用户选择的数据捕获在一个整数数组中,该数组保存每个所选项目的主键。

The next page needs to perform extract all the details of the selected items and draw up a comparison. 下一页需要提取所选项目的所有详细信息并进行比较。

I have two choices: 我有两个选择:

  1. Construct a JSON of selected patient data and pass it two the next page 构建所选患者数据的JSON,然后在下一页将其传递给两个
  2. Pass the array holding the selected primary keys, do another GetJSON with the entire data. 传递包含选定主键的数组,对整个数据执行另一个GetJSON。

Questions 问题

  1. Which is a better choice? 哪个更好的选择?
  2. How do you pass javascript arrays/JSON objects between pages? 如何在页面之间传递javascript数组/ JSON对象?

As told by Maz, the best approach to this situation is to put it all in the same page! 正如Maz所说,解决此问题的最佳方法是将所有内容都放在同一页中! There is no problem of passing the values! 传递值没有问题!

Also the earlier done settings are maintained as we do not navigate to a different page. 此外,由于我们不会导航到其他页面,因此将保留较早完成的设置。

I have put in the graph in one div and put the drill down details in another div. 我已将图表放在一个div中,并将向下钻取的详细信息放入另一个div中。

I selectively hide and un hide these divs. 我选择性地隐藏和隐藏这些div。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM