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
Post a Comment