Hafwen 2023-04-13 00:26 采纳率: 100%
浏览 11
已结题

表单的method设置了post之后仍然是get

不知道为什么表单的method设置了post之后仍然用的是get
请求各位兄弟姐妹们帮忙看看😢
login.html

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>登录</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
    <style>
        * {
            padding: 0;
            margin: 0;
        }
        html {
            height: 100%;
        }
        body {
            font-family: 幼圆, YouYuan;
            background-image: linear-gradient(to bottom right, #111111, #292929);
        }
        .login-container {
            width: 600px;
            height: 315px;
            margin: 0 auto;
            margin-top: 10%;
            border-radius: 15px;
            box-shadow: 0 10px 50px 0px #626262;
            background-color: #626262;
        }
        .left-container {
            display: inline-block;
            width: 310px;
            border-top-left-radius: 15px;
            border-bottom-left-radius: 15px;
            padding: 36px 64px 19px 64px ;
            background-image: linear-gradient(to bottom right, #292929, #343434);
        }
        .title {
            color: #e8e8e8;
            font-size: 18px;
            font-weight: 200;
        }
        .title span {
            border-bottom: 3px solid #08bf62;
            padding: 4px;
        }
        input[type=radio] {
            width: 10px;
        }
        .choice{
            padding-top: 15px;
        }
        .choice span{
            font-size: 14px;
            color: #e8e8e8;
        }
        input {
            border: 0;
            background: none;
            outline: none;
            color: #e8e8e8;
            margin: 15px 0;
            width: 100%;
            padding: 5px 0;
            transition: .2s;
            border-bottom: 1px solid #e8e8e8;
        }
        input:hover {
            border-bottom-color: #e8e8e8;
        }
        ::-webkit-input-placeholder {
            color: #e8e8e8;
        }
        .message-container {
            padding: 40px 35px 20px 45px;
            font-size: 14px;
            color: #08bf62;
            cursor: pointer;
            font-weight: 800;
            line-height: 25px;
        }
        .right-container {
            width: 145px;
            display: inline-block;
            height: calc(100% - 120px);
            vertical-align: top;
            padding: 60px 0;
        }
        .regist-container {
            text-align: center;
            color: #e8e8e8;
            font-size: 18px;
            font-weight: 200;
        }
        .regist-container span {
            border-bottom: 3px solid #08bf62;
            padding: 4px;
        }
        input[type=submit] {
            font-size: 14px;
            color: #e8e8e8;
            text-align: center;
            position: relative;
            width: 75px;
            border: 1px solid #08bf62;
            padding: 10px;
            display: inline;
            line-height: 20px;
            border-radius: 20px;
            bottom: 10px;
            transition: .2s;
            cursor: pointer;
        }
        input[type=submit]:hover {
            background-color: #08bf62;
            color: #e8e8e8;
        }
    </style>
</head>
<body>
    <div class="login-container">
        <div class="left-container">
            <div class="title"><span>登录</span></div>
            <form class="input-container" action="" method="post">
                <div class="choice">
                    <input type="radio" name="info" value="admin" placeholder="管理员"></input><span>管理员登录</span>
                    <input type="radio" name="info" value="user" placeholder="用户"></input><span>普通用户登录</span>                
                </div>
                <input type="text" name="username" placeholder="用户名">
                <input type="password" name="password" placeholder="密码">
                <input class="action-container" type="submit" value="提交"></input>
            </form>
        </div>
        <div class="right-container">
            <div class="regist-container">
                <span class="regist">注册</span>
            </div>
            <div class="message-container">
                <span>如果输入的用户名不存在将自动注册新账号:)</span>
            </div>
        </div>
    </div>
</body>

<script type="text/javascript">
 
    $(document).ready(function(){
        console.log("ready");
        $(".info").each(function(){
            $(this).click(function(){
                console.log("value = "+$(this).val());
            });
        });
    });
</script>
</html>


img

  • 写回答

4条回答 默认 最新

  • Hafwen 2023-04-13 17:34
    关注

    这是我在django框架下遇到的问题 在打开服务器运行以后就出现了报错 发现是少加了

    {% csrf_token %}
    

    参考资料:
    https://blog.csdn.net/feng88724/article/details/7221449

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

问题事件

  • 系统已结题 4月21日
  • 已采纳回答 4月13日
  • 创建了问题 4月13日

悬赏问题

  • ¥15 想问一下树莓派接上显示屏后出现如图所示画面,是什么问题导致的
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号