Passing the values of a form to a PHP script using JavaScript/jQuery
Solution:
I think there is lots of examples of how to do this around. You certainly do not need jquery (much less 2 instances of it). Maybe something like this?
document.querySelector("#submit").addEventListener("submit", function(e){
e.preventDefault(); //stop form from submitting
var form = this;
fetch('create_file.php', {method:'post', body: new FormData(form)})//send the data using fetch
.then(response => response.json()) //get json response
.then(data => console.log(data)); //log the response data
});
Answer
Solution:
You need Jquery and Ajax
and the syntax is so:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script><script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
<script>
$.ajax({
url:"https://yourwebsite.de/file.php",
type:"POST",
data: {
mode: "add", firma: firma, email:email, adresse1: adresse1,adresse2:adresse2 },
success:function(e){
//answer from php file
}});
</script>
Source