You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

110 lines
4.2 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<%String path=request.getContextPath(); %>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
<link rel="shortcut icon" href="<%=path %>/statics/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="<%=path %>/statics/css/font.css">
<link rel="stylesheet" href="<%=path %>/statics/css/xadmin.css">
<script src="<%=path %>/statics/js/jquery.min.js"></script>
<script type="text/javascript" src="<%=path %>/statics/lib/layui/layui.js" charset="utf-8"></script>
<script type="text/javascript" src="<%=path %>/statics/js/xadmin.js"></script>
<title>Insert title here</title>
</head>
<body>
<div class="x-body">
<form class="layui-form" action="/ChinapartyProject/addPostServlet" method="post">
<!-- 标 签 -->
<div class="layui-form-item">
<label for="username" class="layui-form-label">
<span class="x-red">*</span>标签
</label>
<div class="layui-input-inline"><!-- layui输入控件 -->
<input type="text" id="username" name="tag_name" required lay-verify="required"
autocomplete="off" class="layui-input">
</div>
<div class="layui-form-mid layui-word-aux"><!-- layui注释控件 -->
<span class="x-red">*</span>标签名称将会唯一
</div>
</div>
<!-- 创建时间 -->
<div class="layui-form-item">
<label for="username" class="layui-form-label">
<span class="x-red">*</span>创建时间
</label>
<div class="layui-input-inline">
<input class="layui-input" placeholder="创建时间" name="postCDate" id="start">
</div>
</div>
<!-- <input type="submit" value="提交"> -->
<div class="layui-form-item">
<label for="L_repass" class="layui-form-label">
</label>
<button class="layui-btn" lay-filter="add" lay-submit="">
增加
</button>
</div>
</form>
</div>
<script>
layui.use('laydate', function(){
var laydate = layui.laydate;
//执行一个laydate实例
laydate.render({
elem: '#start', //指定元素
trigger:'click'//点击之后弹窗
});
//执行一个laydate实例
laydate.render({
elem: '#end',//指定元素
trigger:'click'//点击之后弹窗
});
});
//监听提交
form.on('submit(add)', function(data){
console.log(data);
console.log(data.field);//显示获取到的数据
//发异步把数据提交给Servlet
$.ajax({
type: 'POST', //用POST方法
url: '/ChinapartyProject/addPostServlet', //往''这个地方
data: data.field, //传输数据
success: function(data){//对返回的数据进行判断
if(data == "Ok"){
layer.alert("增加成功", {icon: 6},function () {
// 获得frame索引
var index = parent.layer.getFrameIndex(window.name);//关闭当前页面
//关闭当前frame
parent.layer.close(index);
//刷新上层页面
window.parent.location.reload();
});
}else{
layer.alert(data,{title:'添加失败'});
}
}
});
return false;
});
});
</script>
</body>
</html>