需要两个js
<script src="${base}/res/layer/layer.js" type="text/javascript"></script>
<script src="${base}/res/ywpx/js/jquery-form.js" type="text/javascript"></script>
<link href="${base}/res/layer/theme/default/layer.css" rel="stylesheet" type="text/css"/>
var index =layer.open({
title: ['添加资质证明', 'font-size:18px;text-align:center;'],
type: 1,
area: ['700px', '250px'],
content: $('#addScheduleDiv'),
shade:0,
zIndex:3,
btn: ["确认", "取消"],
yes: function (index, layero) {
var option = {
url : 'upload.do',
type : 'POST',
dataType : 'json',
success : function(data) {
var msg="";
if(data.states == 1){
msg="上传成功!";
}else{
msg="上传失败!";
}
layer.open({
title:'提示'
,content: msg
});
$("#level").val("");
$("#type").val("");
$("#file2").val("");
layer.close(index);
}
};
$("#addZizhiForm").ajaxSubmit(option);
}
});
html界面
<div id="addScheduleDiv" title="添加资质证明" style="display:none;padding:40px 40px;">
<form action="upload.do" id="addZizhiForm" enctype="multipart/form-data" method="post">
<table >
<td>种类</td>
<td >
<@p.select value="" name="type" id="type" headerValue="--请选择--" list=quaType listKey="value" listValue="name" />
</td>
<td>级别</td>
<td>
<@p.select value="" name="level" id="level" headerValue="--请选择--" list=quaLevel listKey="value" listValue="name" style="width:200px;"/>
</td>
<@p.tr/>
<td >证书:</td>
<td class="pn-fcontent" colspan="2">
<input type="file" name="file2"/>
</td>
<@p.tr/>
</table>
</form>
</div>
效果