jquery – How do I copy localStorage to the PHP submission form?-ThrowExceptions

Exception or error:

I want to copy data from client localStorage to the PHP submission form on the server and be able to submit contact details from the client (i.e., form-validation) and data from localStorage in a single email.

Both jQuery codes work but I receive four emails: i.e., One with localStorage data and the other with contact form information (form-validation details). The other two emails contain no information. Could you help me please?

var data = localStorage.getItem('products');

$.post("validation.php", {
  data: data
}, function(response) {
  console.log(response); // handle the response from the server
});

var order = $('.form-validation');
order.submit(function() {
  $this = $(this);
  $.post($(this).attr('action'), $(this).serialize(), 'json');
  return false;
});
How to solve:

Leave a Reply

Your email address will not be published. Required fields are marked *