Answer the question
In order to leave comments, you need to log in
Saving form data immediately after input?
The task is to improve the life of users:
When filling out an order form for goods in an online store, I want to save the entered data immediately after the transition from one field to another has occurred. Those. the person filled in the name and phone number, and then, while filling in the address, for example, the browser crashed. After restoring the page, I would like to have those fields filled in that he managed to fill out. How to implement?
Answer the question
In order to leave comments, you need to log in
Try Browser Storage. There is a js-library that implements cross-browser support for this technology.
hang on the onchange event saving the fields with ajax
something like
getting data when the page is loaded, I think it will not be a problem to do
$("input[type=text]").bind("onchange", function(){
$.post("ajax.php?saveData", { "name": $(this).attr("name"), "value": $(this).val() })
});
Send by Ajax to the server in the onblur event of inputs and save to the session.
I support. Try it via web storage . If you need support for browsers that can't, there are techniques to implement.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question