Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 814099
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T01:28:00+00:00 2026-05-15T01:28:00+00:00

The discussion begins jQuery: What to do with the list that sortable('serialize') returns? How

  • 0

The discussion begins jQuery: What to do with the list that sortable('serialize') returns?

How to reverse it from last to first, updateList.php?id[]=5&id[]=4&id[]=3&id[]=2&id[]=1&&action=update?

<ul>
<li id="oreder-5">5</li>
<li id="oreder-4">4</li>
<li id="oreder-3">3</li>
<li id="oreder-2">2</li>
<li id="oreder-1">1</li>
<ul>

My code:

$(document).ready(function(){
    order=[];
    $('#list ul').children('li').each(function(idx, elm) { order.push(elm.id.split('-')[1]) });
    $.post('updateList.php', {'order[]': order, action: 'update'});

    function slideout(){
        setTimeout(function(){ $("#response").slideUp("slow", function () {}); }, 2000);
    }
    $("#response").hide();
 $(function() {
    $("#list ul").sortable({ opacity: 0.8, cursor: 'move', update: function() {
   var order = $(this).sortable("serialize") + '&action=update'; 
   $.post("updateList.php", order, function(theResponse){
    $("#response").html(theResponse);
    $("#response").slideDown('slow');
    slideout();
   });
    }});             
 });
});
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T01:28:00+00:00Added an answer on May 15, 2026 at 1:28 am

    This will do it:

    var reversed = $(this).sortable("serialize").split("&").reverse().join("&");
    var order = reversed + '&action=update'; 
    

    In other words:

    • Split the string at the ‘&’.
    • Reverse the resulting array.
    • Join the array with the ‘&’ character to form the reversed serialized string.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

A discussion about Singletons in PHP has me thinking about this issue more and
I had a discussion with some colleagues mentioning that there are not too many
According to this discussion , the iphone agreement says that it doesn't allow loading
The discussion of Dual vs. Quadcore is as old as the Quadcores itself and
After discussion with colleagues regarding the use of the 'var' keyword in C# 3
This discussion started over here but I thought it would be nice to have
A discussion happened today where a grid containing data, which ultimately had data attached
During a discussion about security, a developer on my team asked if there was
I liked the discussion at Differences in Generics , and was wondering whether there
I had a discussion with a developer earlier today re identifying TCP packets going

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.