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

}

});

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

相关推荐
前端小L18 小时前
贪心算法专题(十):维度权衡的艺术——「根据身高重建队列」
javascript·算法·贪心算法
方得一笔18 小时前
自定义常用的字符串函数(strlen,strcpy,strcmp,strcat)
算法
Xの哲學19 小时前
Linux SMP 实现机制深度剖析
linux·服务器·网络·算法·边缘计算
wuk99819 小时前
使用PCA算法进行故障诊断的MATLAB仿真
算法·matlab
额呃呃19 小时前
二分查找细节理解
数据结构·算法
无尽的罚坐人生19 小时前
hot 100 283. 移动零
数据结构·算法·双指针
永远都不秃头的程序员(互关)20 小时前
C++动态数组实战:从手写到vector优化
c++·算法
水力魔方20 小时前
武理排水管网模拟分析系统应用专题5:模型克隆与并行计算
数据库·c++·算法·swmm
蜂蜜黄油呀土豆20 小时前
Redis 底层实现深度解析:从 ListPack 到哈希表扩容
数据结构·redis·zset·sds·listpack·哈希表扩容
谈笑也风生21 小时前
经典算法题型之排序算法(三)
java·算法·排序算法