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

}

});

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

相关推荐
一念&7 分钟前
每日一个C语言知识:C 预处理器
c语言·算法
油泼辣子多加23 分钟前
【实战】自然语言处理--长文本分类(2)BERTSplitLSTM算法
算法·自然语言处理·分类
WWZZ202533 分钟前
快速上手大模型:深度学习2(实践:深度学习基础、线性回归)
人工智能·深度学习·算法·计算机视觉·机器人·大模型·slam
初级炼丹师(爱说实话版)39 分钟前
算法面经常考题整理(1)机器学习
人工智能·算法·机器学习
我不会插花弄玉1 小时前
c语言实现队列【由浅入深-数据结构】
c语言·数据结构
要一起看日出1 小时前
数据结构---------红黑树
java·数据结构·红黑树
被AI抢饭碗的人1 小时前
算法题(246):负环(bellman_ford算法)
算法
大数据张老师2 小时前
数据结构——折半查找
数据结构·算法·查找·折半查找
m0_626535202 小时前
数据结构学习,一些知识点
数据结构·学习
想唱rap2 小时前
C++list类的模拟实现
linux·运维·服务器·数据结构·c++·windows·list