parameter values not passing in jquery ajax method

parameter values not passing in jquery ajax method

Hi All,

My application has a draggable table

following is the code

  1.  $("table#pages tbody").sortable({
                    items: "tr:not(.home)",
                    placeholder: "ui-state-highlight",
                    update: function () {
                        var ids = $("table#pages tbody").sortable("serialize");
                        var url = "/Admin/Shop/ReorderCategories";
                        console.log(ids);
                        $.post(url, ids, function (data) {
                        });
                    }
                });

this is worrking fine and when I drag any row its id is stored in the variable ids .

here id is stored in ids

the problem is ids is not passed to method following is the method for updation

  1. [HttpPost]
            public void ReorderCategories(int[] ids)
            {
                using (Db db = new Db())
                {
                    // Set initial count
                    int count = 1;
    
                    // Declare CategoryDTO
                    CategoryDTO dto;
    
                    // Set sorting for each category
                    foreach (var catId in ids)
                    {
                        dto = db.Categories.Find(catId);
                        dto.Sorting = count;
    
                        db.SaveChanges();
    
                        count++;
                    }
                }
    
            }

     here the method is firing and  ids is showing as null so the code is not working

when i try to find the error using inspect element in browser it is showing

Failed to load resource: the server responded with a status of 404 (Not Found)

console.log(ids) returns like

id[]=1&id[]=2&id[]=3

how to solve this

Regards

Baiju