<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>nps register</title>

    <link href="/static/css/bootstrap.min.css" rel="stylesheet">
    <link href="/static/font-awesome/css/font-awesome.css" rel="stylesheet">

    <link href="/static/css/style.css" rel="stylesheet">

</head>

<body class="gray-bg">

<div class="middle-box text-center loginscreen   animated fadeInDown">
    <div>
        <div>

            <h1 class="logo-name">NPS</h1>

        </div>
        <h3>register NPS</h3>
        <form class="m-t" role="form" onsubmit="return false">
            <div class="form-group">
                <input type="text" class="form-control" placeholder="username" name="username" required="">
            </div>
            <div class="form-group">
                <input type="password" class="form-control" placeholder="password" name="password" required="">
            </div>
            <button onclick="register()" type="submit" class="btn btn-primary block full-width m-b">register</button>

            <a class="btn btn-sm btn-white btn-block" href="/login/index">login</a>
        </form>
    </div>
</div>

<script src="/static/js/jquery-2.1.1.js"></script>
<script>
    function register() {
        $.ajax({
            type: "POST",
            url: "/login/register",
            data: $("form").serializeArray(),
            success: function (res) {
                alert(res.msg)
                if (res.status) {
                    window.location.href = "/login/index"
                }
            }
        })
        return false
    }
</script>
</body>

</html>
