@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Updata</title>
<script src="~/Content/jquery-3.1.1.js"></script>
<style>
* {
padding:0;
margin:0;
}
a {
text-decoration:none;
color:#000000;
}
ul li {
list-style:none;
}
.dao {
}
.bt {
color:red;
}
.Text1 {
margin-top:20px;
width: 180px;
height: 30px;
border-radius:8px 8px;
border:1px solid #808080;
}
.geren {
}
.update {
margin-left:400px;
margin-top:200px;
}
.Button1 {
width: 120px;
height: 30px;
background-color: #0094ff;
color: white;
border: 1px solid #0094ff;
border-radius: 8px 8px;
margin-top:20px;
margin-left:100px;
}
</style>
</head>
<body>
<form id="form0">
<div class="update">
<ul>
<li> 登陆账号:<span class="name" name="spName" id="sp">@ViewBag.Name</span></li>
<li>
原密码:
<input class="Text1" type="password" name="pwd1" />
<span class="bt" id="spPwd1">*</span>
</li>
<li>
新密码:
<input class="Text1" type="password" name="pwd2" />
<span class="bt" id="spPwd2">*</span>
</li>
<li>
确认新密码:
<input class="Text1" type="password" name="pwd3" />
<span class="bt" id="spPwd3">*</span>
</li>
</ul>
<input class="Button1" type="button" value="保存" οnclick="Add()"/>
</div>
</form>
</body>
</html>
<script>
$(function () {
$("input").focus();
$("[name=pwd1]").blur(function () {
$.ajax({
url: "/Login/UserLogin?Name=" + $("[name=spName]").html() + "&Password=" + $("[name=pwd1]").val(),
type: "post",
success: function (data)
{
console.log(data)
if (data> 0) {
$("#spPwd1").html("")
}
else {
$("#spPwd1").html("原密码错误,请重新输入")
}
}
})
})
})
function Add() {
if ($("#spPwd1").html("") == "")
return
$.ajax({
url: "/Login/UserUpdata?Password=" + $("[name=pwd2]").val(),
type: "post",
success: function (data) {
console.log(data)
if (data > 0) {
location.href="/Login/Index"
}
}
})
}
</script>