html表单提交方法

俊飞

2022-04-17 14:53

<form class="layui-form">
    <div class="layui-form-item" style="width: 1100px;">
      <span style="width: 3%;float: left;line-height: 38px;margin: 0 20px;">标题</span>
      <input type="hidden" name="id" value="title">
      <input type="text" name="name" value="学习导航网" autocomplete="off" lay-verify="required" class="layui-input" style="width:  30%;float: left;">
      <span style="line-height: 38px;margin: 0 20px;"> <button style=" background-color: #3ab504;" class="layui-btn layui-btn-mini" lay-submit="" lay-filter="doedit_add">更新</button></span>
    </div>
</form>
<script>    
   layui.use(['form', 'upload'], function() {    
	var form = layui.form,    
	jq = layui.jquery;    
				form.on('submit(doedit_add)', function(data) {    
					loading = layer.load(2, {    
						shade: [0.2, '#000']    
					});    
					var param = data.field;    
					// alert(param.id);    
					jq.post("/index.php/home/navurl/doedit.html",param,function(data){    
						// alert(data.msg);    
						if(data.code == 200){    
					layer.close(data.msg);    
					layer.msg(data.msg, {icon: 1, time: 3000}, function(){    
					     		location.reload();    
					});    
					}else{    
					     	layer.close(data.msg);    
					layer.msg(data.msg, {icon: 2, anim: 6, time: 3000});    
					}    
					});    
				});    
			})    
		</script>


0 条评论

评论:

发送
0.059342s