回复 3楼 静静呀
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>登录</title>
<link rel="stylesheet" href="/projectname/css/bootstrap.min.css">
<script type="text/javascript" src="/projectname/js/jquery-1.11.3.js"></script>
<script src="/projectname/js/bootstrap.min.js"></script>
<script type="text/javascript">
$(function() {
$("#login").bind("click", function() {
$('#myModal').modal('show');
$("#loginForm").get(0).reset();
$("#loginButton").unbind("click");
$("#loginButton").bind("click", function() {
$('#myModal').modal('hide');
var json = $("#loginForm").serialize();
$.post("/projectname/login", json, function(data) {
if (data.type == 1) {
locatin.href="/projectname/success.html";
} else if (data.type == -1) {
alert(data.message);
}
}, "json")
})
});
})
</script>
</head>
<body>
<a href="javascript:void(0)" id="login">登录</a>
</body>
<!-- 登陆,模态框 -->
<div class="modal fade" id="myModal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"
aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<h4 class="modal-title">用户登录</h4>
</div>
<div class="modal-body">
<form id="loginForm">
<table>
<tr>
<td>用户名:</td>
<td><input type="text" name="username" placeholder="请输入用户名"></td>
</tr>
<tr>
<td>密码:</td>
<td><input type="password" name="password" placeholder="请输入密码"></td>
</tr>
</table>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
<button type="button" class="btn btn-primary" id="loginButton">提交</button>
</div>
</div>
</div>
</div>
</html>
[此贴子已经被作者于2018-3-1 23:19编辑过]