I had a form that sent an email via ajax, which had been running smoothly for years. Suddenly, nothing is posted, and I do not understand why.
THE JS:
var name = $("input#name").val();
var email = $("input#email").val();
var telephone = $("input#telephone").val();
var message = $("textarea#message").val();
var dataString = 'name='+ name + '&email=' + email + '&phone=' + phone + '&message=' + message;
$.ajax({
type: "POST",
url: "process.php",
data: dataString,
}
});
Process.php:
<?php
if ($_POST) {
$name = $_POST['name'];
echo : $name;
}
else {
echo 'Nothing is posted';
}
?>
Everytime i use the form, the ajax "works", but "Nothing is posted" appears. I can't find an explanation... For information, I use Jquery 3.1.1, and PHP 7.0