1.通过ajax方法传值
- 判断是否为空,不为空就弹出确定、取消的弹出层
function doSubmitForm() {
var gjc = document.getElementById("gjc").value;
var yzdm = document.getElementById("yzdm").value;
if (gjc.trim() == "") {
layer.msg('请填写检测词组',{
icon : 2,
time : 2000,
anim: 6
}
);
return false;
}
layer.confirm('是否提交监测词组?',{offset: '100px'}, function() {
var params= $("form").serialize();
console.log(params);
$.ajax({
url:"sjjcinsertout.action",
type:"post",
data: params,
dataType:"text",
success:function(data){
var index2 = parent.layer.getFrameIndex(window.name);
parent.layer.close(index2);
alert("监测词组插入成功");
},
error:function(xhr){
alert(xhr.status)
}
});
2.通过自带的layer.open请求action
<input class="layui-btn layui-btn-normal"
style=" color:white;background-color: #7ED321;text-decoration : none"
value="审核通过" onclick="sh_passview()" />
<script>
function sh_passview() {
layer.open({
type : 2,
title : '审核通过',
maxmin : false,
shadeClose : true,
shade : 0.4,
scrollbar : true,
area : [ '80%', '60%' ],
content : 'add_viewAction?yqbh='+yqbh,
offset : '100px'
});
}
</script>