0
我的代码:Jquery tableDnD - 如何创建一个带有ID和位置的ajax?
<script type="text/javascript">
$(document).ready(function() {
// Initialise the table
$('#admintabel').tableDnD({
onDrop: function(table, row) {
}
});
});
</script>
如何创建一个参数的位置和ID Ajax调用示例/sort
有这样的:[position, ID]
onDrop?我的桌子应该如何。
更新:
我想创建一个数组:
BREDBANDS[id] 1
BREDBANDS[id] 2
BREDBANDS[id] 3
我目前的测试数据:
data: {
BREDBANDS: [1, 2, 3] },
而且它发布这样的:
BREDBANDS[] 1
BREDBANDS[] 2
BREDBANDS[] 3
这是给500错误。
我的Rails应用数据被发布到:
def sort
params[:bredbands].each_with_index do |id, index|
Bredband.update_all(['position=?', index+1], ['id=?', id])
end
render :nothing => true
end
如何发布所有IDS的数组? –
这是我的表格http://pastie.org/2675438我想发布IDS,并在我的操作中使用索引来更新订单。 –
@Railsbeginner:查看我编辑的答案。并检查taleDnD的例子和代码背后的代码,你会看到它是如何工作的。 –