i want to save the post data to user pc before posting just incase of bad internet connection where it happens a lot in my area.
most of the time users write article , a
CODE :
function saveEditsBeforeSend(inputIdThatyouWantToGrabState){
var contentOfInput = $(inputIdThatyouWantToGrabState).val();
$.cookie("userInputContentOf"+$(inputIdThatyouWantToGrabState).attr("id"), contentOfInput);
}
Add a event listerner and call it before send
$("#yourFormId").on("submit", function(e){
e.preventDefault();
var form = $(this);
saveEditsBeforeSend(form.find("#inputIdThatyouWantToGrabState"));
form.trigger("submit");
});
This code will store content of input in cookies that you can use later when the connection will be ok. (Note that this content will be lost if the user lost his session) Thats an idea you can perfectionize it