Answer the question
In order to leave comments, you need to log in
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
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 .
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.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question