我创建了一个表格和一些jQuery,以按上下箭头图标的点击对表格行进行重新排序。这工作正常,所以现在我想将新职位发布回服务器,并保留并将其检索到数据库表中。要启用此功能,应该在服务器端创建哪些变量以准备接收数据,以及如何填充这些变量?
$(".up,.down").click(function(){
var row = $(this).parents("tr:first");
if ($(this).is(".up")) {
row.insertBefore(row.prev());
} else {
row.insertAfter(row.next());
}
});
<table class="noBorder" runat="server" id="tblOutcome">
<tr>
<td>
<a href="#" class="up"><img src="../../graphics/blue_up_arrow.gif" /></a>
<a href="#" class="down"><img src="../../graphics/blue_down_arrow.gif" /></a>
</td>
<td>Presentation</td>
</tr>
<tr>
<td>
<a href="#" class="up"><img src="../../graphics/blue_up_arrow.gif" /></a>
<a href="#" class="down"><img src="../../graphics/blue_down_arrow.gif" /></a>
</td>
<td>Investigation</td>
</tr>
<tr>
<td>
<a href="#" class="up"><img src="../../graphics/blue_up_arrow.gif" /></a>
<a href="#" class="down"><img src="../../graphics/blue_down_arrow.gif" /></a>
</td>
<td>Diagnosis</td>
</tr>
<tr>
<td>
<a href="#" class="up"><img src="../../graphics/blue_up_arrow.gif" /></a>
<a href="#" class="down"><img src="../../graphics/blue_down_arrow.gif" /></a>
</td>
<td>Staging</td>
</tr>
</table>