HTML
<form class="layui-form" method="">
<input type="hidden" name="venue_info_id" value="1">
<div class="layui-row" style="padding-top: 40px">
<div class="layui-form-item text-right">
<button class="layui-btn" type="button" lay-filter="doCreateEvent" lay-submit>
<i class="layui-icon"></i>提交保存
</button>
</div>
</div>
</form>
JS
form.on('submit(doCreateEvent)', function(data){
layer.confirm('确定添加预约?', {
skin: 'layui-layer-admin',
shade: .1
}, function (i) {
layer.close(i);
var loadIndex = layer.load(2);
$.post("/api/xxx", data.field, function (res) {
layer.close(loadIndex);
if (200 === res.code) {
layer.msg(res.msg, {icon: 1});
setTimeout(function (){
parent.location.reload();
}, 2500)
} else {
layer.msg(res.msg, {icon: 2});
}
});
});
});
1