I'm currently working on an Ajax call using a query string, but I've hit a roadblock midway through. My goal is to update a SQL table with the JavaScript sortable function. After an item has been moved up or down, I want to pass it through Ajax and have it updated in the SQL database. Any assistance would be greatly appreciated.
$("#tableBody").sortable({
connectWith: "#tableBody",
update: function (event, ui) {
// this.id = #tableBody
// ui.item = Dragged item
console.log(ui.item.attr("data-id"));
console.log(ui.item.attr("data-prod-id"));
console.log(ui.item.index());
$.get('shop_prod_options_update_sort_order.aspx?id=' + id + '&prodid=' + prodid + '&sortorder=' + sortorder);
}
});
<Script Language="VB" RunAt="Server">
Dim intOptionId As Integer = 1
Dim intProdId As Integer = 1
Dim intNewSortOrder As Integer = 0
Dim intOldSortOrder As Integer = 0
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If IsNumeric(Request.QueryString("id")) Then
intOptionId = Val(Request.QueryString("id"))
End If
If Request.QueryString("sortorder") = "sortorder" Then
intOptionId = True
Else
intOptionId = False
End If
If Not IsPostBack Then
UpdateList()
End If
End Sub
Private Sub UpdateList()
' Database connection and SQL queries here
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
</form>
</body>
</html>