weixin_33725515 2016-02-05 17:14 采纳率: 0%
浏览 91

iOS AJAX发布“无法正常工作”

Here is the problem. We have a Unifi access point, that gives a customer the ability to use our wifi. The splash page asks the user to enter their name and email. It posts to a Google Form, which saves the information to a spreadsheet. It works on everything except iPhones. The iPhone goes straight to aol.com after the user enters their information. Gives them internet access but does not post the form info to the spreadsheet.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Classic City Computing, Inc.</title>

  <link rel="stylesheet" type="text/css" href="<unifi url="css/bootstrap.min.css"/>" />
  <link rel="stylesheet" type="text/css" href="<unifi url="css/stylesheet.min.css"/>" />
  <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
        <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
  <script type="text/javascript" src="<unifi url="js/jquery.min.js"/>"></script>
  <script type="text/javascript" src="<unifi url="js/guest.js"/>"></script>
  <script type="text/javascript" src="<unifi url="js/bootstrap.min.js"/>"></script>
  <!-- <script type="text/javascript" src="<unifi url="js/ajax.min.js"/>"></script> -->
</head>

<body class="login-page">
    <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
        <div class="container">
            <div class="navbar-header">
                <div class="navbar-brand"><img src="images/logo_263x117.png"></div>
            </div>
        </div>
    </nav>

    <!-- Page Content -->
    <div class="container">
        <div class="row">
            <div class="col-md-6 col-sm-12 top_bot_spacer">
                <picture>
                    <img
                    sizes="(max-width: 680px) 100vw, 680px"
                    srcset="
                    images/Office_Building_y8e0ob_ar_1_1,c_fill__c_scale,w_200.png 200w,
                    images/Office_Building_y8e0ob_ar_1_1,c_fill__c_scale,w_350.png 350w,
                    images/Office_Building_y8e0ob_ar_1_1,c_fill__c_scale,w_463.png 463w,
                    images/Office_Building_y8e0ob_ar_1_1,c_fill__c_scale,w_483.png 483w,
                    images/Office_Building_y8e0ob_ar_1_1,c_fill__c_scale,w_680.png 680w"
                    src="images/Office_Building_y8e0ob_ar_1_1,c_fill__c_scale,w_680.png"
                    alt="Classic City Computing, Inc." class="img-responsive border_pic">
                </picture>
            </div>
            <div class="col-md-6 col-sm-12 top_spacer">
                <div>
                    <h2>Welcome to Classic City Computing, Inc.</h2>
                    <p>Our office is pleased to offer <em>free</em> WIFI Internet access to our customers.</p>
                </div>
                <form action="login" method="POST" name="ajaxform" id="ajaxform" target="_self">
                    <div class="form-group">
                        <input type="text" name="entry.1695384387" value="" class="form-control" id="entry_2089228670" dir="auto" aria-label="First Name  " title="" required placeholder="First Name">
                    </div>
                    <div class="form-group">
                        <input type="text" name="entry.1159332327" value="" class="form-control" id="entry_444646544" dir="auto" aria-label="Last Name  " title="" required placeholder="Last Name">
                    </div>
                    <div class="form-group">
                        <input type="text" name="entry.790568677" value="" class="form-control" id="entry_1742184287" dir="auto" aria-label="Email Address  " title="" required placeholder="Email Address">
                    </div>
                    <br>
                    <input type="hidden" name="draftResponse" value="[,,&quot;-6998185097431954589&quot;]">
                    <input type="hidden" name="pageHistory" value="0">
                    <input type="hidden" name="fvv" value="0">
                    <input type="hidden" name="fbzx" value="-6998185097431954589">
                    <input name="connect" type="submit" id="connect" class="btn btn-primary" value="Submit" >
                </form>
            </div>
        </div>
        <!-- /.row -->
    </div>
    <!-- /.container -->

    <footer class="navbar-inverse navbar-fixed-bottom">
        <div class="text-center">&copy;2016 All Rights Reserved</div>
    </footer>

<script type="text/javascript">
jQuery(document).ready(function() {
    jQuery('input').keypress(function(e) {
        var code = (e.keyCode ? e.keyCode : e.which);
        if ( (code==13) || (code==10)) {
            jQuery(this).blur();
            return false;
        }
    });
});
</script>

<script>
$("#ajaxform").submit(function(e) {
  // alert("Test");
    var postData = $(this).serializeArray();
    //var formURL = $(this).attr("action");
    var first = $('#entry.1695384387').val();
    var last = $('#entry.1159332327').val();
    var email = $('#entry.790568677').val();

    if ((first !== "") && (last !== "") && (email !== "")) {
        $.ajax({
            url: "https://docs.google.com/forms/d/XXX/formResponse",
            data: postData,
            crossDomain: true,
            type: "POST",
            dataType: "xml",
            statusCode: {
                0: function () {
                    //Success
                    $.ajax({
                        url: "https://docs.google.com/forms/d/XXX/formResponse",
                        data: postData,
                        crossDomain: true,
                        type: "POST",
                        dataType: "xml",
                        timeout: 5000,
                        statusCode: {
                            0: function () {
                                //Success
                                window.location.replace("http://www.aol.com");
                            },
                            200: function () {
                                //Success
                                window.location.replace("http://www.reddit.com");
                            }
                        }
                    });
                },
                200: function () {
                    //Success
                    window.location.replace("http://www.reddit.com");
                }
            }
        });
    } else {
        //Fail
        window.location.replace("fail.html");
    }
    // e.preventDefault();
});
</script>

</body>
</html>
  • 写回答

1条回答 默认 最新

  • weixin_37859724 2021-05-31 17:10
    关注

    湿哒哒

    评论

报告相同问题?

悬赏问题

  • ¥15 宇视监控服务器无法登录
  • ¥15 PADS Logic 原理图
  • ¥15 PADS Logic 图标
  • ¥15 电脑和power bi环境都是英文如何将日期层次结构转换成英文
  • ¥20 气象站点数据求取中~
  • ¥15 如何获取APP内弹出的网址链接
  • ¥15 wifi 图标不见了 不知道怎么办 上不了网 变成小地球了
  • ¥50 STM32单片机传感器读取错误
  • ¥50 power BI 从Mysql服务器导入数据,但连接进去后显示表无数据
  • ¥15 (关键词-阻抗匹配,HFSS,RFID标签天线)