When submitting form data, the submit button is of submit type. When layui is used as the js framework, the form data will be submitted repeatedly. To prevent this, the effective method is:
In <form>, add lay-filter="formConfig" , οnsubmit="return false" , where "formConfig" is custom, and then within the submitted button event:
("submit(formConfig)",function(data){ return false; });
Specific practices:
1. In form:
<form class="layui-form" name="addform" lay-filter="formConfig" method="post" action="" enctype="multipart/form-data" οnsubmit="return false" > <button type="submit" class="btn btn-primary radius" >submit</button>
2. In the submitted button event:
$(function(){ $("#btnSave").click(function(){ ('form',function(){ var form=; (); ("submit(formConfig)",function(data){ return false; }); }); $.ajax({ // to do...... }); });
The above method to prevent repeated submission of Layui form forms is all the content I share with you. I hope you can give you a reference and I hope you can support me more.