Safari不会将表单数据发送到电子邮件

时间:2017-09-26 13:23:28

标签: javascript php html ajax safari

我遇到了这个问题,除了Safari之外的所有浏览器都会将表单发送给电子邮件。使用Chrome一切都运行良好,但笔记本电脑和i手机上的Safari无法发送任何内容。仅在清除缓存后有时。也许你知道如何解决它? 此外,在服务器上我有日志(ASCII文本,行很长)



$('#form-order').submit(function() { 
    var form_data = $(this).serialize();
    var cookies = document.cookie.split(";");
    for (var i = 0; i < cookies.length; i++)
    eraseCookie(cookies[i].split("=")[0]);
    $.ajax({
    type: "POST", 
    url: "data/order.php", 
    data: form_data,
    cache: false,
    success: function() {
    }
})});
&#13;
<form id="form-order" name="order-form">
   <div class="container-fluid">
   <div class="row">
      <div class="col-md-6">
         <label for="name">Name:</label>
         <input type="text" name="user-name"required id="name" >
      </div>
      <div class="col-md-6">
         <label for="surname">Surname:</label>
         <input type="text" name="user-surname" id="surname" >
      </div>
   </div>
   <div class="row">
      <div class="col-md-6">  
         <label for="phone">Phone number:</label>
         <input type="tel" name="phone-number" placeholder="+375291111111" required  id="phone" >
      </div>
      <div class="col-md-6">  
         <label for="email">E-mail:</label>
         <input type="email" name="user-email" placeholder="mail@mail.com" id="email">
      </div>
   </div>
</form>
&#13;
&#13;
&#13;

    $to = "sohoflowersby@gmail.com";  

    $subject = 'Форма приема заказа'; 
    $message = '
            <html>
                <head>
                    <title>'.$subject.'</title>
                </head>
                <body>

                    <p>Name: '.$_POST['user-name'].'</p>
                    <p>Surname: '.$_POST['user-surname'].'</p>
                    <p>Phone: '.$_POST['phone-number'].'</p>
                    <p>Email: '.$_POST['user-email'].'</p>

                </body>
            </html>'; 

    $headers  = "Content-type: text/html; charset=utf-8 \r\n"; 
    $headers .= "From: Отправитель <sohoflowersby@gmail.com>\r\n"; 
    mail($to, $subject, $message, $headers); 
?>

0 个答案:

没有答案