layui form 表单提交 用 ajax提交
<form class="addvoteform layui-form">
<button class="layui-btn layui-btn-sm" lay-submit lay-filter="formDemo2" >确定</button>
</form>
form.on('submit(formDemo2)', function(data){
/* layer.msg(JSON.stringify(data.field)) */
$.ajax({
url:"../Contestant/Employee.do",
async: false,
type:"POST",
dataType: "text",
data:data.field,
success: function(data){
if($("#isphone").val()==0){
var index = parent.layer.getFrameIndex(window.name);
parent.layer.close(index);
}else {
window.history.go(-1);
}
}
})
return false;
});
来源:oschina
链接:https://my.oschina.net/u/4399698/blog/3640421