V
V
Vkok2021-06-28 18:24:37
PHP
Vkok, 2021-06-28 18:24:37

Why is the registration form on the site not working?

Hello, the ajax form on the site does not work, please help me figure it out.
60d9e89faaeb7659997757.jpeg
Page with a form .
The following files are used for the form to work:
1) /js/common.js
2) /mail.php

other sites on the same server use the same form, everything works. and this site does not work

1)

$(document).ready(function () {

    $("#form").submit(function () {
        $.ajax({
            type: "POST",
            url: "/mail.php",
            data: $(this).serialize()
        }).done(function () {
            $(this).find("input").val("");
            alert("Вы записаны!");
            $("#form").trigger("reset");
        });
        return false;
    });

});


2)
<?php
$recepient = "почта@почта.ru";
$sitename = "Запись к врачу";
$name = trim($_POST["name1"]);
$name = trim($_POST["name2"]);
$phone = trim($_POST["phone"]);
$phone = trim($_POST["data"]);
$phone = trim($_POST["time"]);
$message = "Имя: $name \nТелефон: $phone \nДата: $data \nДата: $time \nСообщение: $text";
$pagetitle = "Письмо \"$sitename\"";
mail($recepient, $pagetitle, $message, "Content-type: text/plain; charset=\"utf-8\"\n From: $recepient");

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question