Local Storage

Hello all,

    I am trying to build a web application, where most of the data is to be stored on client side because data changes very often. Only when user presses submit data, data stored on client side should be pushed to server.

    How to store data on client side? How to retrieve data from server on submit(no forms).

    Data to be stored on client side is ActiveRecord retrieved from database.

regards, Praveen

Hey,

Can you describe “Data” , you mean files or just variables ? If its just files then im not sure but if its variable, you can use javascript global variables or front end frameworks like angular or backbone.

Hello vivek,

   I need to store a variables (nested hashmap) on client side and data in hashmap changes very frequently. When user clicks submit button, data has to be pushed to server.

regards, praveen

Then use javascript hash tables

http://www.mojavelinux.com/articles/javascript_hashes.html

and when user clicks submit send the hash table as “data” field in ajax

I am trying find the best solution in this case, even json object looks similar to javascript hash tables you have mentioned. I am refering to json object as rails renders json object.

json can be passed as data field in ajax.

Is there a question in the statement above? If so it is not clear what the question is.

Colin

Hello,

   I have to store nested hashmap on client side, which is the best way to store nested hashmap on client side. Values inside activerecord change in client side. When submit button is pressed, hashmap has to be sent to server through ajax.

regards, Praveen

Please quote the message you are responding to when replying so that we know which message you are replying to. There is no point just repeatedly making the same statement again and again. Praveen made a suggestion and you have not responded to it as far as I can see.

The point has been made that you will have to use javascript to do processing on the client side. Are you familiar with the use of javascript? If not then you have some learning to do. Find a good tutorial on javascript and work through it. Then if you need help with a particular point on how to interface between rails and javascript come back with specific questions.

Also if you do not know about using the session for storing moderate amounts of data look up how to use that in rails, it may be useful for your application.

Colin

Depends on what your data is used for.

If your data needs to be shared among sessions, local storage of html5 would be an option.

If not, global variable can meet your requirements. I guess.