Jquery Ajax在firefox中不起作用

时间:2017-09-26 10:04:17

标签: jquery ajax

我使用谷歌表单和我的HTML和AJAX,但问题是它与Chrome一起正常工作,我还在我的移动浏览器中对其进行了测试,它在移动Chrome但也无法在iphone的Safari浏览器中使用,而且它无法使用Firefox代码如下:

HTML:

<form>
    <h1 class="text-uppercase h3 f-open-sans-b text-center tgreen tmargin0">Order Form</h1>
    <div class="form-group">
        <input type="text" name="entry.940219732" id="pName" hidden="true" value="Watch for Men" />
        <input type="text" name="entry.1912140262" id="pPrice" hidden="true" value="999" />
        <input class="form-control" placeholder="Full Name" type="text" requitred="requitred"  value="" id="fname" name="entry.193588199" />
    </div>
    <div class="form-group">
        <input class="form-control" placeholder="Email Address" type="email"  value="" id="email" name="entry.1819118509" />
    </div>
    <div class="form-group">
        <input class="form-control onlyNumerics" id="mobile" placeholder="Mobile Number - 03451234567" requitred="requitred" type="tel" pattern="[0-9]*"  value="" name="entry.1331713511" />
    </div>

    <div class="form-group">
        <textarea class="form-control" rows="2" placeholder="Address" requitred="" id="address" name="entry.1955183047"></textarea>
    </div>

    <div class="form-group">
        <textarea class="form-control" id="city" rows="1" placeholder="City" name="entry.1929451429"></textarea>
    </div>
    <div class="row">
        <div class='col-md-12 bmargin10'>
            <div class="form-group">
                <!--<label class="control-label">Qty</label>    -->     
                <select id="size" name="entry.774706026" class="form-control input-sm">
                    <option value="0">--Select Size--</option>
                    <option value="1">1</option>
                    <option value="2">2</option>
                    <option value="3">3</option>
                    <option value="4">4</option>
                    <option value="5">5</option>
                    <option value="6">6</option>
                    <option value="7">7</option>
                    <option value="8">8</option>
                    <option value="9">9</option>
                </select>
            </div>
        </div>

        <div class='col-md-12 bmargin10'>
            <div class="form-group">
                <!--<label class="control-label">Qty</label>    -->     
                <select id="color" name="entry.1992561494" class="form-control input-sm">
                    <option value="0">--Choose Color--</option>
                    <option value="1">1</option>
                    <option value="2">2</option>
                    <option value="3">3</option>
                    <option value="4">4</option>
                    <option value="5">5</option>
                    <option value="6">6</option>
                    <option value="7">7</option>
                    <option value="8">8</option>
                    <option value="9">9</option>
                </select>
            </div>
        </div>
    </div>
    <div class="row">
        <div id="qflag" class="col-md-12"></div>
    </div>
    <div class="col-md-12 lpadding">
        <a class="btn btn-orange btn-block" id="x">
            <img src="https://www.example.com/images/quickbuy-icon.png" class="quickbuy-icon">
            Place Order
        </a>
    </div>
    <div class="tcenter">
        <img src="https://www.example.com/images/custom-loader.gif" class="balls_loader" alt="Loading...">
    </div>
    <input type="submit" class="btn btn-green" id="qload_btn" ><i class="fa fa-spinner fa-pulse"></i>  


</form>

JavaScript Ajax:

<script type="text/javascript">

    $(document).ready(function () {
        $("#x").click(function () {
            var pName = $("#pName").val();
            var pPrice = $("#pPrice").val();
            var fname = $("#fname").val();
            var email = $("#email").val();
            var mobile = $("#mobile").val();
            var address = $("#address").val();
            var city = $("#city").val();
            var size = $("#size").val();
            var color = $("#color").val();
            var status = "New Order";
            // Returns successful data submission message when the entered information is stored in database.
            var dataString = 'entry.940219732=' + pName + '&entry.1912140262=' + pPrice + '&entry.193588199=' + fname + '&entry.1819118509=' + email + '&entry.1331713511=' + mobile + '&entry.1955183047=' + address + '&entry.1929451429=' + city + '&entry.774706026=' + size + '&entry.1992561494=' + color;
            if (fname == '' || email == '' || city == '' || address == '' || mobile == '')
            {
                alert("Please Fill All Fields");
            } else
            {

                // AJAX Code To Submit Form.
                $.ajax({
                    type: "POST",
                    url: "https://docs.google.com/forms/d/e/1FAIpQLSfdjU4QZGY2NNdhYyw6qabSe9wSoryvpq563H_hQzjxDCqDRQ/formResponse",
                    data: dataString,
                    cache: false,
                    success: function (result) {
                        alert(result);
                        location.reload();
                    }
                });
                window.location.replace("http://shoppyshopping.com/thanks.php");
            }
            return false;
        });
    });
</script>

请帮助我,我将全心全意地感谢你:)

0 个答案:

没有答案