所以现在我有一个序列化我的DataTable的所有输入的问题。我尝试获取每个分页表的所有值,然后通过AJAX发送到服务器,但在此之前我使用控制台和序列化日期调试我的代码如下所示:
车%5BGA117110020001%5D = 0&安培;购物车%5BCA117210020001%5D = 0&安培;购物车%5BZA117210020001%5D = 0&安培;购物车%5BCA117310020001%5D = 0&安培;购物车%5BZA117310020001%5D = 0&安培;购物车%5BZA117310030001%5D = 0&安培;购物车%5BZC117410020001%5D = 0&安培;购物车%5BZB117410020001%5D = 0&安培;购物车%5BZA117510020001%5D = 0&安培;购物车%5BZA117610020001%5D = 0&安培;购物车%5BZA117010020001%5D = 0&安培;购物车%5BOX103812000001%5D = 0&安培;购物车%5BZC103812000001%5D = 0&安培;购物车%5BZA103812000001%5D = 0&安培;购物车%5BZB103812000001%5D = 0&安培;购物车%5BOX103815000001%5D = 0&安培;购物车%5BZC103815000001%5D = 0&安培;购物车%5BZA103815000001%5D = 0&安培;购物车%5BZB103815000001 %5D = 0&安培;购物车%5BOX103808500001%5D = 0&安培;购物车%5BZC103808500001%5D = 0&安培;购物车%5BZA103808500001%5D = 0&安培;购物车%5BZB103808500001%5D = 0&安培;购物车%5BZA103712000001%5D = 0&安培;购物车%5BZB103712000001%5D = 0&安培;购物车%5BZA103715000001%5D = 0&安培;购物车%5BZB103715000001%5D = 0&安培;购物车%5BZA103708500001%5D = 0&安培; ...
我不知道为什么,但是我得到的每一行'%5B' product.code'%5D',如何使用每行中的输入值准备数组或JSON对象?
这是我的js代码:
$(document).ready(function () {
$('#datatable-default').DataTable();
$('#getData').click( function () {
var paginator = $('#datatable-default').DataTable();
var dat = paginator.$('input').serialize();
console.log(dat);
alert("stop");
});
});
我的输入如下:
<input type="number" class="spinner-input form-control" min="0" value="0" name="cart[{{ product.code }}]" />