
<form method="post" id="ResetPasswordForm">
    <label>新密码:<input type="password" name="np" /></label>
    <label>再次输入:<input type="password" name="np1" /></label>
    <input type="button" id="submit" value="提交" />
    <span id="errMsg"></span>
</form>

<script type="text/javascript">
    $(function () {
        $("#submit").click(function () {
            debugger;
            var p1 = $("input[name='np']").val();
            var p2 = $("input[name='np1']").val();
            if (p1 != p2) {
                $("#errMsg").html("两次输入的密码不一致");
                return;
            }
            var url = "api/user/changepassword";
            var ticket = myJs.getTicket();
            myJs.post(url, { ticket:ticket, nPassword:p1 }, function (d) {
                $("#ResetPasswordForm").html("<span>修改成功</span>");
            }, function (s, i, m) {
                $("#ResetPasswordForm #errMsg").html("<span>" + m + "编号:" + i + "</span>");
            })
        });
    });
</script>