When submitting the feedback form, does an error occur?

  • 0
    $('#sendMail').on('click', function () {
      let name = $('#name').val().trim();
      let face = $('#face').val().trim();
      let personal_account = $('#personal_account').val().trim();
      let addres = $('#addres').val().trim();
      let email = $('#email').val().trim();
      let phone = $('#phone').val().trim();
      let text = $('#text').val().trim();
        url: '../ajax/mail.php',
        type: 'POST',
        cache: false,
        data: {
          "name": name,
          "face": face,
          "personal_account": personal_account,
          "addres": addres,
          "email": email,
          "phone": phone,
          "text": text,
        dataType: 'html',
        beforeSend: function () {
          $('#sendMail').prop('disabled', true);
        success: function(data) {
          if (!data) 
            alert('Были ошибки, сообщение не отправлено')
          $('#sendMail').prop('disabled', false);

      $name = $_POST['name']
      $face = $_POST['face']
      $personal_account = $_POST['personal_account']
      $addres = $_POST['addres']
      $email = $_POST['email']
      $phone = $_POST['phone']
      $text = $_POST['text']
      $subject = "=?utf-8?B?".base64_encode("Сообщение с сайта")."?=";
      $headers = "From: $email\r\nReply-to: $email\r\nContent-Type: text/html; charset=utf-8\r\n"
      $success = mail("[email protected]", $subject, $message, $headers)

    <form id="form">
              <div class="feedback-form">
                <div class="feedback-form__name">
                  <div class="feedback-form__title">Наименование организации / ФИО.*</div>
                  <input type="text" name="name" id="name" placeholder="Наименование организации / ФИО.*" class="form-input"
                <div class="feedback-form__face">
                  <div class="feedback-form__title">Контактное лицо</div>
                  <input type="text" name="face" id="face" placeholder="Контактное лицо" class="form-input">
                <div class="feedback-form__personal-account">
                  <div class="feedback-form__title">Лицевой счет*</div>
                  <input type="text" name="personal_account" id="personal_account" placeholder="Лицевой счет*"
                    class="form-input" required>
                <div class="feedback-form__addres">
                  <div class="feedback-form__title">Адрес*</div>
                  <input type="text" name="addres" id="addres" placeholder="Адрес*" class="form-input" required>
                <div class="feedback-form__email">
                  <div class="feedback-form__title">E-mail*</div>
                  <input type="email" name="email" id="email" placeholder="E-mail*" class="form-input" required>
                <div class="feedback-form__phone">
                  <div class="feedback-form__title">Контактный телефон*</div>
                  <input type="text" name="phone" id="phone" placeholder="Контактный телефон*" class="form-input" id="phone"
                    value="999 999 99 99" required>
                <div class="feedback-form__text">
                  <div class="feedback-form__title">Текст сообщения*</div>
                  <textarea type="text" name="text" id="text" placeholder="Текст сообщения*" class="form-input text"
                <div class="feedback-form__fail">
                  <div class="feedback-form__title file">Прикрепить к приложению файл</div>
                  <input type="file" name="file" id="file" class="inputfile" />
                  <label for="file" class="input-file">Выбрать файл</label>
              <button type="button" class="send" id="sendMail">Отправить сообщение</button>

    JavaScript Aiden Waller, May 13, 2019

  • 1 Answers
  • 0
    You are trying to send information to someone else's domain, this error will not occur if you send a form from your domain to your own domain.
    Elliott Waller

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!