Sorting items and posting extra variable to PHP
- jQuery(document).ready(function(){
jQuery('.sort').sortable({
cursor: 'move',
axis: 'y',
update: function(e, ui) {
href = ajaxpath2;
jQuery(this).sortable("refresh");
sorted = jQuery(this).sortable("serialize", 'id');
jQuery.ajax({
type: 'POST',
url: href,
data: sorted,
success: function(msg) {
//do something with the sorted data
alert("Your itemshave been re-ordered");
}
});
}
});
The code sorts the items and it updates the database using the id. But I want to send an additional variable of the category ID in the post I can use in my PHP. Here is the HTML where I can drag and reorder. The variable i want to sent is $pr['cat_id'].'
- <tr class="row' . ($i++ % 2). '" id= pid_'. $pr['prod_id'].' >';