如何提交多个具有相同name属性的表单

<form class="cell" lay-filter="myform2" enctype="multipart/form-data">

<p class="pp">add</p>

<div class="dss">

<div class="cell-mi">

<input type="text" name="inputa[]"><p class="del">del</p>

<div class="layui-form-item un_cloud">

<label class="layui-form-label" style="width: 100px">是否申请课酬</label>

<div class="layui-input-inline" style="width: 300px">

<input type="radio" name="is_fee[]" value="1" title="是">

<input type="radio" name="is_fee[]" value="2" title="否" checked>

</div>

</div>

</div>

</div>

<button class="layui-btn" lay-submit id="submit" lay-filter="go">提交</button>

<button class="tij" style="height: 100px">提交</button>

</form>

$(".pp").click(function () {

console.log(1111)

html = ' <div class="cell-mi"><input type="text" name="inputa[]"><p class="del">del</p>';

html += ' <div class="layui-form-item un_cloud">';

html += ' <label class="layui-form-label" style="width: 100px">是否申请课酬</label>';

html += ' <div class="layui-input-inline" style="width: 300px">';

html += ' <input type="radio" name="is_fee[]" value="1" title="是" >';

html += ' <input type="radio" name="is_fee[]" value="2" title="否" checked>';

html += ' </div>';

html += ' </div></div>';

$(".dss").append(html)

})

$('.dss').on('click', '.del', function(){

console.log('del')

(".cell-mi").eq((this).index()).remove();

})

$(".tij").click(function () {

console.log(2222)

var data = $('.cell').serializeArray();

$.ajax({

url: "{{url('/admin')}}",

type: "post",

dataType: "json",

data: data,

success: function (data) {

if (data.status == 1) {

layer.msg(data.msg, {

icon: 1,

time: 1000,

end: function () {

parent.location.reload(true);

parent.layer.closeAll();

}

});

} else {

layer.msg(data.msg, {icon: 2, time: 1000});

return false;

}

},

error: function () {

layer.msg('连接服务器失败!', {icon: 2, time: 1000});

return false;

}, complete: function () {

layer.close(loading_index);

}

});

前台打印看不出效果,后台打印可以看出效果

相关推荐
CoderYanger3 小时前
递归、搜索与回溯-穷举vs暴搜vs深搜vs回溯vs剪枝:12.全排列
java·算法·leetcode·机器学习·深度优先·剪枝·1024程序员节
憨憨崽&3 小时前
进击大厂:程序员必须修炼的算法“内功”与思维体系
开发语言·数据结构·算法·链表·贪心算法·线性回归·动态规划
chem41114 小时前
C 语言 函数指针和函数指针数组
c语言·数据结构·算法
liu****5 小时前
八.函数递归
c语言·开发语言·数据结构·c++·算法
客梦5 小时前
数据结构-树结构
数据结构·笔记
CM莫问5 小时前
详解机器学习经典模型(原理及应用)——岭回归
人工智能·python·算法·机器学习·回归
DuHz5 小时前
论文阅读——Edge Impulse:面向微型机器学习的MLOps平台
论文阅读·人工智能·物联网·算法·机器学习·edge·边缘计算
梦想的旅途25 小时前
基于雪花算法(Snowflake)的 Go 语言唯一 ID 生成与并发安全实现
算法·安全·golang
Vanranrr5 小时前
C++临时对象与悬空指针:一个导致资源加载失败的隐藏陷阱
服务器·c++·算法
老约家的可汗6 小时前
数据结构之栈和队列
数据结构