Answer the question
In order to leave comments, you need to log in
What is the best way to implement the mechanism for saving data from a large form?
When editing a large form, the user sends a POST to the server. If the form is filled out incorrectly, I make a redirect indicating a filling error, while the data may be resent.
But after redirecting the form, the data is lost. How to make the user's form data remain after filling in and return filling errors to him?
Throw it all into local storage? or fill out the form according to the data previously filled in by the user?
Answer the question
In order to leave comments, you need to log in
$(document).ready(function(){
$("идентефикатор_кнопки_для_отправки_данных_формы").click(function() {
//собераем все данные из формы
var form_data = new FormData("идентификатор_формы");
$.ajax({
type: "POST", //Метод отправки
url: "путь_до_файла",
data: form_data,
success: function() {
},
error:function(){
},
});
});
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question