Home>Article>Web Front-end> How to use layer pop-ups and layui forms to add new functions

How to use layer pop-ups and layui forms to add new functions

尚
forward
2020-01-10 17:12:59 4917browse

How to use layer pop-ups and layui forms to add new functions

1. Requirement: Use layer to complete the addition in the pop-up window. After success, prompt and refresh the page (parent page, list page)

2. Implementation

Page rendering

How to use layer pop-ups and layui forms to add new functions

Page code:

Build from form

Create layer pop-up window

function onAddBtn(){ //页面层-自定义 layer.open({ type: 1, title:"新建配置", closeBtn: false, shift: 2, area: ['400px', '300px'], shadeClose: true, // btn: ['新增', '取消'], // btnAlign: 'c', content: $("#add-main"), success: function(layero, index){}, yes:function(){ } }); }

Core submission method

Backend code

/** * 新增配置 * @return */ @RequestMapping("/add1") @ResponseBody public ResultEntity addItem(ZkGolbal golbal) { ResultEntity res = new ResultEntity(); try { golbal.setStatus("1"); res.setData(golbalService.addItem(golbal)); res.setSuccess("success"); res.setMessage("新增成功"); } catch (Exception e) { res.setMessage("操作失败"); e.printStackTrace(); } return res; }

For more layui knowledge, please pay attention to the PHP Chinese websitelayui usage tutorialcolumn.

The above is the detailed content of How to use layer pop-ups and layui forms to add new functions. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:cnblogs.com. If there is any infringement, please contact admin@php.cn delete