S
S
Sailaubai Shyngys2015-09-30 15:10:25
JavaScript
Sailaubai Shyngys, 2015-09-30 15:10:25

How to temporarily save variables with jQuery?

Good afternoon! There is a form which I deduce through AJAX. The form template is generated via php. Every time the user wants to checkout, AJAX inserts a freshly prepared form. If you fill out the form, then close the modal window, and then open the form back to fill out, an unfilled form opens. Is it possible to save the completed form data somewhere when closing the modal window and then, when a new form is reopened, fill in the inputs. I wanted to use cookies and when generating the form, fill it out using php. But is there a way to implement it in pure JS (jQuery)

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Dmitry Korolev, 2015-09-30
@chyngys

Cookie in this case - tin can. With each request to the server, they rush back and forth like mad. Is it necessary?
The ideal option in your case is localStorage. He is supported ... until almost everyone supports him .

D
Dmitry Novikov, 2015-09-30
@dmitriy_novikov

Get variables or hidden inputs (on the main page), where you will save the values ​​​​with each change in the form field.
When calling ajax, check if there is anything in these variables/inputs. If there is - substitute.

I
Ilya Bobkov, 2015-09-30
@heksen

localStorage

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question