0

I have a project I am currently working on where it has a number of stored values that the user can select. The application has a number of pages and I have come across something called parsing data and recalling.

I am looking to save out the information when the user changes the values. Bit hard to explain so I have included a picture.

https://i.stack.imgur.com/Ebg20.jpg

So the user can change the POWER, Spot Diameter, Exposure Time and Radius, then when the page changes those values can be recalled again.

I am using Javascript variables with jquery, as i want this application to be cross platform and be able to run on an ipad.

user3323371
  • 89
  • 3
  • 10
  • Your "question" is a bit vague. If you describe the problem, and the specify a single question, "how can i..." rather than simply stating a problem, then you may get more answers quicker... – Daniel Mar 13 '14 at 13:47

2 Answers2

1

Probably the easiest way to store and retrieve data is using cookies. jQuery.cookie (https://github.com/carhartl/jquery-cookie) is probably your best bet. It's very easy to use, reliable, and takes away all the complexities of it. Make sure you use the path: variable to save them to / or something.

You can also save data to HTML5 '(local)storage'. http://diveintohtml5.info/storage.html has an introduction, although it's a bit over detailed in the history.

To be honest, cookies are probably the easiest way to go.

If you want to store data in such a way that people can read the same data from different computers, then you'll need to store it in a database (or whatever) on the server.

Daniel
  • 1,410
  • 12
  • 17
0

Like Daniel mentioned you could use cookies, altough nowadays you're expected to show a statement that you're using cookies and describe what they're for which leaves users usually doubtful in these "oh noes! my privacy!"-times ;) Ideally you could use "html5" localstorage instead, as the rules on local storage are considerably more vague ;)

However, perhaps this is overthinking the design, you mention you have only a handful of variables, if these are shared throughout all the pages of your application, why not make them part of a query string in the URL ?

You can append these variables using either the good 'ol hashtag or ?-parameters, like so:

http://www.yourdomain.com/somepage/?power=500&counter=28&spot=200&exposure=20&radius=1600

Then when your page loads you can use Javascript to check whether these parameters are present (this site has some excellent examples on how to retrieve query string values in JavaScript). This also has the benefit that you could share this URL as a deeplink and it will set these values automatically for the visitor (should this be desired, of course ;))

Community
  • 1
  • 1
Igor Zinken
  • 884
  • 5
  • 19