jquery-ui彈框登入前端寫法

來源:互聯網
上載者:User

標籤:oda   logs   ajax   url   idt   sign   ==   password   關閉   

                建立一個div:

<div class="container" id="loginForm" hidden>    <h4 class="form-signin-heading">使用者登入</h4>    <hr />    <div class="form-group">        <input type="text" class="form-control" id="KeyName" placeholder="Auth Key" name="Key">    </div>    <div class="form-group">        <input type="password" class="form-control" id="Pwd" placeholder="Auth Secret" name="Secret">    </div>    <div class="form-group">        <button class="btn btn-large btn-primary" id="btnLogin" onclick="LoginCheck()">登入</button>    </div></div>

                彈框js寫法,可以存放在初始化中:

function showDialogLogin() {            $("#loginForm").dialog({                height: 300,                width: 200,                // 模態開啟                  modal: true,                // 是否可拖拽                  draggable: true,                // 最小寬度                  minWidth: 300,                //當使用者按 Esc 鍵之後,是否應該關閉對話方塊,預設為 true                closeOnEscape: true            });        }

                       擷取值登入:

function LoginCheck() {        var key = $("#KeyName").val();        var Secret = $("#Pwd").val();        var data = { key, Secret }        $.ajax({                type: "post",                dataType: "json",                url: ‘/account/Login‘,                data: data,            success: function (res) {                if (res.Message == "success") {                    $("#loginForm").dialog(‘close‘);                }                else {                    alert("請重新輸入");                }            },            error: function () {                alert("請重新輸入");            },        });    };

 

jquery-ui彈框登入前端寫法

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.