jquery-ui彈框登錄前端寫法


                新建一個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("請重新輸入"); }, }); };

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM