<ul style="list-style: none">
    <li class="user-header">
        <input type="text" id="regUsername" placeholder="username" />
        <input type="password" id="regPassword" placeholder="password" />
        <input type="email" id="regEmail" placeholder="example@qualcosa.qualcosa" />
        <label>Doc?</label><input type="checkbox" id="regDoctor" />
        <div>
            <button class="btn-default btn btn-flat" id="register-btn">Register</button>
        </div>
        <p id="msg-reg" class="login-box-msg"></p>
    </li>
</ul>

<script>
    $("#register-btn").on("click", function () {
        var regUsername = $("#regUsername").val();
        var regPassword = $("#regPassword").val();
        var regEmail = $("#regEmail").val();
        var regDoctor = $("#regDoctor").is(":checked");
        $.ajax({
            url: "/Account/_register",
            data: { Username: regUsername, Password: regPassword, Email: regEmail},
            dataType: "json",
            type: "POST",
            success: function (data) {
                //se data.success->reload 
                //se data.fail->indica errori

                console.log(data);
                var msg = $("#msg-reg");
                if (data.success) {
                    window.location.reload();
                } else {
                    msg.html(data.message).show();
                }
            },
            error: function (xhr, status, error) {
                alert(xhr.responseText)
            }
        })
    });
</script>