jQuery(document).ready(function() { $("#main-form").submit(function() { $.ajax({ type: "POST", url: "../../form.php", data:$(this).serialize(), success: function() { alert('Π’Π°ΡˆΠ° заявка ΠΎΡ‚ΠΏΡ€Π°Π²Π»Π΅Π½Π°!') } }); // event.preventDefault(); return false; }); }); 
 <form id="main-form" method="POST"> <p>Π’Ρ‹Π±Π΅Ρ€ΠΈΡ‚Π΅ ΡƒΠ΄ΠΎΠ±Π½Ρ‹ΠΉ способ связи, ΠΌΡ‹ ΠΏΠ΅Ρ€Π΅Π·Π²ΠΎΠ½ΠΈΠΌ Π»ΠΈΠ±ΠΎ напишСм ΠΈ Π²Ρ‹ смоТСтС Π·Π°Π΄Π°Ρ‚ΡŒ всС ΠΈΠ½Ρ‚Π΅Ρ€Π΅ΡΡƒΡŽΡ‰ΠΈΠ΅ вас вопросы. Π’Π°ΠΊ-ΠΆΠ΅ ΠΏΡ€ΠΎΠΈΠ·Π²Π΅Π΄Π΅ΠΌ рассчСт стоимости вашСго Π±ΡƒΠ΄ΡƒΡ‰Π΅Π³ΠΎ Π²ΠΈΠ΄Π΅ΠΎ-Ρ€ΠΎΠ»ΠΈΠΊΠ°</p> <div class="radio__container"> <label> <input type="radio" name="messenger" value="email" checked> <span><img src="assets/img/links/1.png"></span> </label> <label> <input type="radio" name="messenger" value="email" checked> <span><img src="assets/img/links/2.png"></span> </label> <label> <input type="radio" name="messenger" value="email" checked> <span><img src="assets/img/links/viber.png"></span> </label> <label> <input type="radio" name="messenger" value="email" checked> <span><img src="assets/img/links/3.png"></span> </label> <label> <input type="radio" name="messenger" value="email" checked> <span><img src="assets/img/links/4.png"></span> </label> <label> <input type="radio" name="messenger" value="email" checked> <span><img src="assets/img/links/5.png"></span> </label> <label> <input type="radio" name="messenger" value="email" checked> <span><img src="assets/img/links/6.png"></span> </label> </div> <input type="text" required placeholder="Π£ΠΊΠ°ΠΆΠΈΡ‚Π΅ ваш ΠΌΠΎΠ±ΠΈΠ»ΡŒΠ½Ρ‹ΠΉ" name="phone" id="phone"> <input type="text" required placeholder="Π£ΠΊΠ°ΠΆΠΈΡ‚Π΅ вашС имя" name="name" id="name"> <input type="submit" value="Π—Π°ΠΏΡ€ΠΎΡΠΈΡ‚ΡŒ Π·Π²ΠΎΠ½ΠΎΠΊ" id="submit"> </form> 

  <?php $adminemail="leoteam53@yandex.ru"; // e-mail Π°Π΄ΠΌΠΈΠ½Π° $backurl1="http://pasha/"; // ΠŸΡ€ΠΈΠ½ΠΈΠΌΠ°Π΅ΠΌ Π΄Π°Π½Π½Ρ‹Π΅ с Ρ„ΠΎΡ€ΠΌΡ‹ $name=$_POST['name']; $phone=$_POST['phone']; $messenger=$_POST['messenger']; $msg="name:". $name . " phone:" . $phone . " messenger:" . $messenger . ""; mail("$adminemail", "Π‘ΠΎΠΎΠ±Ρ‰Π΅Π½ΠΈΠ΅ ΠΎΡ‚ $name", "$msg"); exit; 
  • Your mail () function parameters should be passed as parameters, not as a string. What does the server write? And why do you print if you use ajax? (Return). Exit is a function, you don’t need it here at all. - Vladislav
  • $ (this) .serialize () can refer to the scope of a function, not a form. - XelaNimed
  • one
    $("#main-form").submit(function() { - you must accept the event and cancel it: $("#main-form").submit(function(enevt) { event.preventDefault(); Why use url: "../../form.php", ,? Your complicated question, even if I gave an error for an example or described a problem. - Vladislav
  • The console does not give any error. Alert is displayed, but the message does not come. - Pavel

0