大佬们,请问我的web项目正常运行了,但是密码输入后登陆按钮不跳转是什么情况?

正常启动后,空白的时候,点击登陆和注册会给提示。但是输入完相关信息后 再次点击就没有反应了。请问这是什么情况?怎么解决

一般登录都是post请求,你这个地方写的get  估计是找不到后端的登录接口吧

贴源码。

<form id="ff" method="post">

加上action属性,指明登录后的地址。

<form id="ff" method="post" action="url">

打开控制台,报错了。 最好贴图。

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>电信服务平台</title>
    <link href="./easyui/themes/default/easyui.css" rel="stylesheet" />
    <link href="./easyui/themes/icon.css" rel="stylesheet" />
    <script src="./easyui/jquery-3.3.1.min.js"></script>
    <script src="./easyui/jquery.easyui.min.js"></script>
</head>
<body class="easyui-layout">
<!--<h2>Basic Form</h2>
<p>Fill the form and submit it.</p>-->
<div data-options="region:'north'" style="height:900px;text-align:center;font-size:48px;color:#ffffff;background:url(./images/2365.jpg) no-repeat">
    <div id="head" style="margin:110px 0 0 30px;">电信服务平台</div>

    <div style="margin:10px 0 0 580px;">
        <div class="easyui-panel" title="欢迎登录电信服务平台" style="width:100%;max-width:400px;padding:30px 60px;">

            <form id="ff" method="post">


                <div class="loginlabel" style="white-space:nowrap;">
                    <span style="width:60px;display:inline-block;">用户名:</span>
                    <input name="username" class="radius3" tabindex="1" id="username" style="font-size:18px;width:200px;" type="text">
                </div>
                <div class="loginlabel" style="white-space:nowrap;margin-top:10px;">
                    <span style="width:60px;display:inline-block;">密码:</span>
                    <input name="userpass" class="radius3" tabindex="2" id="userpass" style="font-size:18px;width:200px;" type="password">
                </div>
                <div style="margin-top:10px">
                    <span style="width:60px;display:inline-block;">身份:</span>
                    <select class="easyui-combobox" id="roles" name="state" style="width:200px;">
                        <option name="Xs" id="xs" value="0">用户</option>
<!--                        <option name="Ls" id="ls" value="1">管理员</option>-->
                    </select>
                </div>

            </form>
            <div id="dlg-buttons" style="text-align:center;padding:5px 0">

                <a href="javascript:void(0)" class="easyui-linkbutton" onclick="login()" style="width:80px;margin-left:85px;">登录</a>
                <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="newUser()" style="width:80px">注册</a>

            </div>
        </div>
    </div>
    <div id="dlg" class="easyui-dialog" style="width:400px" data-options="closed:true,modal:true,border:'thin',buttons:'#dlg-buttons1'">
        <form id="fm" method="post" novalidate style="margin:0;padding:20px 50px">
            <h3>用户信息</h3>
            <!--                <div style="margin-bottom:10px">-->
            <!--                    <input id="userid0" name="UserId" class="easyui-textbox" required="true" label="用户ID:" style="width:100%">-->
            <!--                </div>-->
            <div style="margin-bottom:10px">
                <input id="username0" name="UserName" class="easyui-textbox" required="true" label="用户名:" style="width:100%">
            </div>
            <div style="margin-bottom:10px">
                <input id="userpass0" name="UserPass" class="easyui-textbox" required="true" label="密码:" style="width:100%">
            </div>
            <div style="margin-bottom:10px">
                <input id="phone" name="Phone" class="easyui-textbox" required="true" label="手机号:" style="width:100%">
            </div>
            <div style="margin-bottom:10px">
                <input id="email" name="Email" class="easyui-textbox" label="邮箱:" style="width:100%">
            </div>
            <div style="margin-bottom:10px">
                <select editable="false" class="easyui-combobox" id="regeditroles" required="true" name="regeditroles" label="身份:" style="width:100%;">
                    <option name="Xs" value="0">用户</option>
<!--                    <option name="Ls" value="1">管理员</option>-->
                </select>
            </div>
        </form>
    </div>
    <div id="dlg-buttons1">
        <a href="javascript:void(0)" class="easyui-linkbutton c6" iconCls="icon-ok" onclick="saveUser()" style="width:90px">Save</a>
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlg').dialog('close')" style="width:90px">Cancel</a>
    </div>


    <script type="text/javascript">
        var url;
        function newUser() {
            $('#dlg').dialog('open').dialog('center').dialog('setTitle', '注册');
            $('#fm').form('clear');
            url = '/api/user/adduser0';
        }
        function saveUser() {
            var uid = $("#userid0").val();
            //console.log("uid", uid);
            var uname = $("#username0").val();
            var upass = $("#userpass0").val();
            var phone = $("#phone").val();
            var email = $("#email").val();
            var LoginRoles = $('#regeditroles').combobox('getValue');
            if (!uname || !upass || !LoginRoles) {
                $.messager.alert('提示', '用户姓名、密码、身份不能为空!', '信息');
                return false;
            }
            var str = $("#phone").val();
            var reg = /^(0|86|17951)?(13[0-9]|15[012356789]|18[0-9]|14[57]|17[678])[0-9]{8}$/;
            if (!reg.test(str)) {
                $.messager.alert('提示', '手机号格式不正确!请重新输入', '信息');
                return false;
            }

            if (!email.match(/^[a-zA-Z0-9_-]+@([a-zA-Z0-9]+\.)+(com)$/)) {
                $.messager.alert('提示', '邮件格式不正确!请重新输入', '信息');
                $("#email").focus();
                return false;
            }
            var postdata = {
                "username": uname,
                "password": upass,
                "phoneNo": phone,
                "email": email,
                "roles": LoginRoles
            };
            $.ajax({
                url: url,
                type: 'post',
                data: JSON.stringify(postdata),
                contentType: "application/json;charset=utf-8",
                success: function (r) {
                    //var r=JSON.parse(result);
                    if (r.flag == 1) {

                        $.messager.alert('提示', '注册成功!', '信息');
                        $('#dlg').dialog('close');
                        //$('#dg').datagrid('reload');

                    }
                    else if (r.flag == 0) {
                        $.messager.alert('提示', '添加失败!', '信息');
                    }
                    else if (r.flag == 9) {
                        $.messager.alert('提示', '该用户已经存在,请勿重复注册!', '信息');
                    }
                    else {
                        $.messager.alert('提示', '参数不对!', '信息');
                    }
                }
            });
        }
        function login() {
            var username = $("#username").val();
            var userpass = $("#userpass").val();
            var LoginRoles = $('#roles').combobox('getValue');
            if (!username || !userpass) {
                $.messager.alert('提示', '请输入用户或密码!', '信息');
                return false;
            }
            var postdata = {
                "username": username,
                "password": userpass,
                "role": LoginRoles
            };
            //?username='+username+'&password='+userpass+'&role='+LoginRoles
            $.ajax({
                url: '/api/login',
                type: 'get',
                data: postdata,
                success: function (result) {
                    var r=JSON.parse(result);
                    if (r.flag == 1) {
                        $.messager.alert('提示', '登录成功,正在跳转页面!', '信息');
                        if (LoginRoles == 0) {
                            //界面
                            window.location.href = "index1.html";
                        } else {
                            //界面
                            window.location.href = "index.html";
                        }
                    }
                    else if (r.flag == 0) {
                        $.messager.alert('提示', '登录失败,请检查身份是否正确!', '信息');
                    }
                }
            });
        }
        //function clearForm() {
        //    $('#ff').form('clear');
        //}
    </script>

</div>

</body>
</html>

 

我这个程序前两天还可以跑,不知道为什么现在就不行了

您好,我是有问必答小助手,您的问题已经有小伙伴解答了,您看下是否解决,可以追评进行沟通哦~

如果有您比较满意的答案 / 帮您提供解决思路的答案,可以点击【采纳】按钮,给回答的小伙伴一些鼓励哦~~

ps:问答VIP仅需29元,即可享受5次/月 有问必答服务,了解详情>>>https://vip.csdn.net/askvip?utm_source=1146287632

非常感谢您使用有问必答服务,为了后续更快速的帮您解决问题,现诚邀您参与有问必答体验反馈。您的建议将会运用到我们的产品优化中,希望能得到您的支持与协助!

速戳参与调研>>>https://t.csdnimg.cn/Kf0y