【发布时间】:2015-04-27 09:16:13
【问题描述】:
我是第一次使用 jquery 数据表,所以现在我做了这样的表
一切正常。现在我在下面的 javascript 代码中使用它
$(document).ready(function() {
$('#example').dataTable(
{
"pageLength": 50,
'sDom': 'l' ,
} );
$('#example tfoot th').each( function ()
{
var title = $('#example thead th').eq( $(this).index() ).text();
$(this).html( '<input type="text" style="width:100%;" id="munna_'+title+'" placeholder="Search '+title+'" />' );
});
var table = $('#example').DataTable();
table.columns().every( function ()
{
var that = this;
$( 'input', this.footer() ).on( 'keyup change', function () {
that
.search( this.value )
.draw();
});
});
$('#munna_button').click( function()
{
var data = table.$('input, select').serialize();
alert(JSON.stringify(data))
return false;
});
});
现在此代码在 rate_14=67&rate_15=87&rate_67=88 等中返回类似这样的值,
现在我不知道如何将其存储在 SUBMIT 中。通常在提交时我会像这样得到 $_POST['name'],现在请有人帮我解决这个问题。
【问题讨论】:
-
你需要调用ajax。在需要接受 php 中的 post 请求的地方添加 ajax url。
$.ajax({url:"", type:"POST", data:"serializeData"}); -
@Munna 尝试 $.ajax() 访问api.jquery.com/jquery.ajax
-
但是可以输入超过 20 个值,所以当我在 ajax 中输入时可能需要更多时间,这就是我在提交时询问的原因
标签: javascript php jquery serializearray