Почему функция jQuery ajax не работает на устройствах с браузером iOS

Я делаю функцию для отправки формы Google с помощью ajax, она работает в браузерах Desktop и Android, но не работает в браузерах IOS. Любая помощь?

HTML:

<div class = "googleformContactresponde" id = "googleformContactrespondeID"></div>

<form action = "" method = "post" id = "ss-form" onsubmit = "return done();">
    <div class = "form-group">
        <label>Name</label>
        <input class = "form-control" id = "name" name = "entry.1899579046" minlength = "3" required = "" aria-required = "true" type = "text">
        <div class = "errorchick" id = "c_name"></div>
    </div>
    <div class = "form-group">
        <label>Email</label>
        <input class = "form-control" id = "email" name = "entry.1718424446" required = "" aria-required = "true" type = "email"></div>
    <div class = "form-group">
        <label>Phone Number</label>
        <input class = "form-control" id = "phone" name = "entry.1228435843" minlength = "3" maxlength = "25" required = "" aria-required = "true"
         type = "text"></div>
    <div class = "form-group">
        <label>Message</label>
        <textarea class = "form-control" id = "msg" name = "entry.1329820139" minlength = "3" maxlength = "500" required = ""
         aria-required = "true"></textarea>
    </div>
    <div class = "form-group">
        <div id = "form-slider-status"></div>
        <button type = "submit" id = "form-slider-submit" class = "btn btn-default">Send</button>
    </div>
</form>

JS:

<script type = "text/javascript">
    function done() {
        var c_name = jQuery("#name").val();
        if (c_name == "") {
            jQuery("#c_name").show().html("please enter the name");
            setTimeout(function () {
                jQuery("#c_name").hide()
            }, 2000);
            jQuery("#name").focus(); return false;
        } else {
            jQuery.ajax({
                url: "urlsubmit",
                type: "POST",
                dataType: "jsonp",
                cache: false,
                data: { "entry.1899579046": jQuery("#name").val(), "entry.1718424446": jQuery("#email").val(), "entry.1228435843": jQuery("#phone").val(), "entry.1329820139": jQuery("#msg").val(), "entry.396737882": jQuery("#hide").val() },
                success: function (response) { alert("success"); }
            });
            jQuery("#ss-form")[0].reset();
            return false;
        }
    }
</script>

живой тест: https://www.judran-eg.com/en/property/midtown-sky

Как конвертировать HTML в PDF с помощью jsPDF
Как конвертировать HTML в PDF с помощью jsPDF
В этой статье мы рассмотрим, как конвертировать HTML в PDF с помощью jsPDF. Здесь мы узнаем, как конвертировать HTML в PDF с помощью javascript.
0
0
165
2
Перейти к ответу Данный вопрос помечен как решенный

Ответы 2

Поместите весь свой код jQuery в этот блок:

jQuery(document).ready(function(){
 // your code
 init();
});

спасибо за попытку помочь мне, но это тоже не работает @Amir

Fawzy Zayed 13.01.2019 11:13
Ответ принят как подходящий

Я исправляю эту проблему, речь идет о перенаправлении на другую страницу. Я установил функцию тайм-аута, чтобы отложить перенаправление, чтобы убедиться, что форма отправлена.

setTimeout(function(){ location.href = "'.$url.'";  }, 1000);

Другие вопросы по теме