Answer the question
In order to leave comments, you need to log in
Why does ajax form work on localhost but not on global?
I created an ajax form on the site, but it only works on local hosting, it doesn't work on global hosting, please tell me how to fix this problem?
https://hr-consulting-vtust.ru - here is this site
https://codepen.io/Voldemar_Kurakin/details/MWaNwzo - here is a link to HTML forms and JQuery with ajax request.
Here is the PHP form handler:
<?php
$recipient = "[email protected]";
$sitename = "HR and organizational consulting";
$name1 = trim($_POST["name1"]);
$phone = trim($_POST["phone"]);
$email = trim($_POST["email"]);
$dropdown = trim($_POST["dropdown"]);
if (isset($name1) ) {
$name=stripslashes($name1);
$name=htmlspecialchars($name1);
}
if (isset($phone) ) {
$name=stripslashes($phone);
$name=htmlspecialchars($phone);
}
if (isset($email) ) {
$name=stripslashes($email);
$name=htmlspecialchars($email);
}
$message = "Name: $name1 \r\nPhone number: $phone \r\nEmail: $email \r\nSelected service: $dropdown";
$pagetitle = "You have received a new application from \"$sitename\"";
mail($recepient, $pagetitle, $message, "Content-type: text/plain; charset=\"windows-1251\"\n From: $recipient");
?>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question