<div id="logInForm">
    <form fajax-success="loginOnSucc" fajax-failure="loginOnError" method="post" action="/api/User/Login">
        <div class="form-group"><label>用户名：<input class="form-control" type="text" name="userName" /></label></div>
        <div class="form-group"><label>密码：<input class="form-control" type="password" name="password" /></label></div>
        <input type="submit" class="btn btn-primary" value="登录" />
        <span id="errormsg"></span>
    </form>
</div>
<script type="text/javascript">
    function loginOnSucc(d) {
        var _userKey = myJs.userKey;
        $.cookie(_userKey, d.Ticket);
        if (RefreshUserBar) RefreshUserBar();
        $("#logInForm").hide();
    }
    function loginOnError(d) {
        var msg = d.responseJSON.Message;
        $("#errormsg").text(msg);
    }
</script>