login.html
<!DOCTYPE html>
<html>
<head>
<title>登录</title>
<link rel="stylesheet" type="text/css" href="css/login.css">
<script src="js/bootstrap.min.js"></script>
<script src="js/jquery.min.js"></script>
<script src="js/frame.js"></script>
<meta charset="UTF-8">
</head>
<body>
<div class="contain">
<div class="logintop">
</div>
<div class="loginbody">
<div class="logindiv">
<form id="loginform" name="loginform" class="loginform">
<ul>
<li>
<input name="username" type="text" class="loginuser" value="" placeholder="输入账号" maxlength="100" id="username" errormsg="密码长度在6-16位之间"/>
</li>
<li>
<input name="password" type="password" class="loginpwd" value="" placeholder="输入密码" id="password" errormsg="密码长度在6-16位之间"/>
</li>
<li>
<input name="btnRtSubmit" type="button" class="loginbtn" id="btnRtSubmit" value="登录"/>
</li>
</ul>
</form>
</div>
</div>
<div class="loginbottom">
版权所有 2019 Star-Net
</div>
</div>
</body>
</html>
frame.js
(function($){
alert("1");
function login(event){
alert("2");
event.preventDefault();
var userName = $("#username").val();//获取用户名
var password = $("#password").val();//获取密码
//Ajax向后台提交用户名、密码
alert("userName:"+userName+" password:"+password);
$.post("/UserManager/loginController.do",{
username:userName,
password:password
},
function(data){
if((typeof(data)!="undefined")&&(null!= data)
&&(0==data)){
//登录成功后隐藏登录表单
$(".contain").hide();
//登录成功后跳转到用户列表页
$("#content").load("/UserManager/listUserController.do");
}
});
}
$("#btnRtSubmit").bind("click",login);//为btnRtSubmit绑定事件
})($);
我觉得问题应该出在frame.js上,但找不出问题在哪,大佬救我