weixin_33701294 2017-12-15 08:33 采纳率: 0%
浏览 36

Phonegap Ajax登录失败

i have a an app that runs with phonegap. When i try to login using phonegap desktop app server the login works. But when i upload the app on phonegap build and i download the apk, install the app the login recive "failure". So using phonegap desktop app works, using build login fails, can you help me please? Here is the code:

<form class="login-form test"  method="POST">
        <h3 class="form-title">Sign In</h3>
        <div class="alert alert-danger display-hide">
            <button class="close" data-close="alert"></button>
            <span>
            Enter any username and password. </span>
        </div>
        <div class="form-group">
            <!--ie8, ie9 does not support html5 placeholder, so we just show field title for that-->
            <label class="control-label visible-ie8 visible-ie9">Email</label>
            <input class="form-control form-control-solid placeholder-no-fix" type="text" autocomplete="off" placeholder="Email" name="username" id="username"/>
        </div>
        <div class="form-group">
            <label class="control-label visible-ie8 visible-ie9">Parola</label>
            <input class="form-control form-control-solid placeholder-no-fix" type="password" autocomplete="off" placeholder="Parola" name="password" id="password"/>
        </div>

        <div class="form-actions">
            <button type="submit" class="btn btn-success uppercase" id="login">Login</button>

        </div>
        <div id="msg"></div>
    </form>

<script>
$(function() {

    $("button#login").click(function(e){
        e.preventDefault();
            $.ajax({
            type: "POST",
            url: "http://porsche.e-twow.uk/mobile/login.php", 
            data: $('form.test').serialize(),
            dataType: 'json',
            success: function(data){
                    if(data.error == "error_msg")
                        {
                        $("#msg").html('Email-ul sau parola nu corespund.')
                        }
                    else if (data == "obligatoriu")
                        {
                        $("#msg").html('Va rugam completati emailul si parola')
                        }
                        else if (data == "captcha")
                        {
                        $("#msg").html('Va rugam bifati "Im not a robot"')
                        }
                        else if ( data.tip ==4 )
                        {

               window.location.replace("rezervari.html");
               Cookies.set('id_user', data.id_user , { expires: 7 });
                   }
                   else if ( data.tip ==3 )
                        {

               window.location.replace("admin/clienti.php");
                   }

                                   },

        error: function(){
            alert("failure");
            }
              });
    });
});
</script>
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
    • ¥15 Vue3地图和异步函数使用
    • ¥15 C++ yoloV5改写遇到的问题
    • ¥20 win11修改中文用户名路径
    • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
    • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
    • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
    • ¥15 帮我写一个c++工程
    • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
    • ¥15 关于smbclient 库的使用