jquery - Is it possible to use Javascript to temporarily store data while User adjusts, and then pass as Hash to Rails Controller? -


at high level, building application allows user request items other users located in same county requesting user. user , item both models associated databases.

on request page, i'm trying build 3 components.

1) map shows

  • a marker each other user
  • when clicked on, marker displays popup lists items that user has. requesting user can click on each item add list of items s/he request

2) set of search fields allows requesting user filter markers users , items on map, example, perhaps dates_available.

3) "cart" (not literally since not e-commerce) shows items requesting user has added, final submit button. note, dates_available should not search field, part of request

a not perfect example screenshot getaround:

enter image description here

i'm pretty new coding in general, want think through plugins, apis, shortcuts, etc. below reference, if have comments on how implement better, please tell me! right now, thinking of using:

for map:

  • openlayers.org
  • gmaps.js

for search (which filtering capability):

the key question

for "cart" , click item add "queue" part, realize while can in rails purely, might less of positive ux experience since page re-render every time new item added, not mention it'd potentially result in excessive pings database or records created. i'm thinking of using javascript make "cart/queue" staging area temporary storage, user populates whatever items s/he wants , edits needed, it's not until final submit click entire group of items passed hash rails controller saved.

now, since don't know js well, resources on how (easy plug-in solutions, other considerations may have missed) or if it's not possible (in case pray tell) appreciated.

thanks!

you may try javascript localstorage.

localstorage.mytempvalue = "my temp value"; 

or

localstorage("key", "value"); 

you can store object:

var person = { name: "xxxxx", age: 35 };  localstorage.person = person; 

hope answer may trigger idea in you!


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -