I have a form where the data is sent through an email when I click on a button.
The issue I have is that I want the same data to be inserted into a table.
I found a solution on here: send the form values to multiple pages
but I don't know how to insert that portion of code in mine.
This is the code I put in my page:
<script language="Javascript">
<!--
$('form').submit(function() {
$.ajax({
async: false,
method: 'POST',
url: 'submit.php',
data: $( this ).serialize(),
success: function() {
window.location.href = "http://stackoverflow.com"; //redirect to this page
}
});
$.ajax({
async: false,
method: 'POST',
url: 'appuntamento.php',
data: $( this ).serialize(),
success: function() {
window.open("http://www.stackoverflow.com"); //this page will be open in new tab
}
});
});
-->
</script>
The fact is that I don't know if I inserted it right and I don't know how to call the function on the button.