如何提交多个具有相同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);

}

});

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

相关推荐
计算机小白一个1 小时前
蓝桥杯 Java B 组之背包问题、最长递增子序列(LIS)
java·数据结构·蓝桥杯
MZWeiei1 小时前
PTA:运用顺序表实现多项式相加
算法
卑微的小鬼1 小时前
数据库使用B+树的原因
数据结构·b树
GISer_Jing1 小时前
Javascript排序算法(冒泡排序、快速排序、选择排序、堆排序、插入排序、希尔排序)详解
javascript·算法·排序算法
cookies_s_s1 小时前
Linux--进程(进程虚拟地址空间、页表、进程控制、实现简易shell)
linux·运维·服务器·数据结构·c++·算法·哈希算法
不想编程小谭2 小时前
力扣LeetCode: 2506 统计相似字符串对的数目
c++·算法·leetcode
水蓝烟雨2 小时前
[HOT 100] 2187. 完成旅途的最少时间
算法·hot 100
醉城夜风~3 小时前
[数据结构]双链表详解
数据结构
菜鸟一枚在这3 小时前
深度解析建造者模式:复杂对象构建的优雅之道
java·开发语言·算法
gyeolhada4 小时前
2025蓝桥杯JAVA编程题练习Day5
java·数据结构·算法·蓝桥杯