1
我目前正在製作一個可排序的表,並且需要將更多的id傳遞給序列化數組。如何將自定義變量添加到jQuery可排序?
我添加了所有我的代碼exept後文件,該dossent relly做任何事情比var_dumping張貼。
<!DOCTYPE html>
<html lang="en">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="container">
<div class="row">
<div class="col-md-12"><br><br><br><br>
<table class="display table table-striped table-hover table-bordered dt-responsive responsive nowrap" cellspacing="0" width="100%">
<thead>
<th>Navn</th>
<th>Order</th>
</thead>
<tbody id="sortable">
<tr id="order_1" data-extravalue="45">
<td>value</t>
</tr>
<tr id="order_2" data-extravalue="56">
<td>value</t>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
<script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script type="text/javascript" src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#sortable').sortable({
update: function(event, ui) {
var order = $("#sortable").sortable('serialize');
$.ajax({
data: order,
type: 'POST',
url: 'post.php'
});
}
});
});
</script>
</body>
</html>
首先,你應該正確地關閉你''標籤:''。其次,你想收集哪些其他信息? – Twisty