javascript - Fetch localStorage values to other page using id -


i storing values in localstorage , values getting stored through input[type:hidden] , input[type:text]. js:

$('.proceed_btn').on('click', function() {   // blank start    var order = {};    // loop through inputs...   $('input[type="text"], input[type="hidden"]').each(function() {     // ...adding values properties     order[this.name] = this.value;   });    // store object in json format   localstorage.setitem("order", json.stringify(order)); }); 

i want print these value in other page when user redirects after submitting form. working on ruby currently. there many products in website, information in summary page gets rendered according that. there way display specific form details in through there id's?

you can create partial .js.erb extension eg _order_partial.js.erb , retrieve order object thus:

order = json.parse(localstorage.getitem("order")); // loop through object , print out 

then can render partial in of views file want use it.


Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -