Form ajax reloads the page, and php and not drawn, how to fix?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
12 views
that's actually the code itself
function ok() {return swal('Благодоарим','Мы с вами свяжемся!','Успешно')}

$(document).ready(function ( $("#form").submit( function (event) { e.preventDefault(); event.preventDefault(); $.ajax(( url: "mail.php", type: "post", data: $("#form").serialize(); ) } ); ){ })

<?php$header = "From: " . $name . " <" . trim($_POST['contact_email']) . ">". PHP_EOL; $EOL = "\\"; $subject= '=?utf-8?B?' . base64_encode($subject_text) . '?='; $theme = "Custom"; $letter ="message Data: Name:".$_POST["name"]; $letter .=" Mail:".$_POST["email"]; $letter .=" Message:".$_POST["message"]; mail('hydrapc@yandex.ru', $theme , $letter); echo '';echo 'alert("Successful!")';?>
by | 12 views

2 Answers

0 like 0 dislike
$(document).ready(function() { $("#form").submit( function (event) { event.preventDefault(); $.ajax({ url: "mail.php", type: "post", data: $("#form").serialize(); }); return false; }); });
by
0 like 0 dislike
jQuery(function ($) { var $form = $('#form'); $form.submit(function (event) { event.preventDefault(); $.ajax({ url: 'mail.php', type: 'POST', data: $form.serialize() }) }) })
by

Related questions

0 like 0 dislike
1 answer
asked May 21, 2019 by mishaweb
0 like 0 dislike
2 answers
0 like 0 dislike
3 answers
110,608 questions
257,186 answers
0 comments
36,635 users