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 6735141
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:58:25+00:00 2026-05-26T10:58:25+00:00

I am using jQueryUI 1.8.14. I would like to implement a sortable list and

  • 0

I am using jQueryUI 1.8.14. I would like to implement a sortable list and to save related item position changes in my application database each time an user changes an item position.

To do that I am planning to retrieve and serialize the id value and the new position value of the item that has just changed its position (I need to make that so to generate and prepare data in order to perform an AJAX HTTP request). Anyway, using the serialize method as descibed in the official documentation it will serialize all item id values in a submittable string (eg: key=1&key=2&...), but I would like to serialize only the current item id value and retrieve its new position value.

How can I make\code that?


At this time I am trying to implement that functionality this way:

JavaScript code:

$jQ(function() {
  $jQ("#sortable_list").sortable({
    placeholder: "ui-state-highlight",
    update: function(event, ui) {

      // Here I would like to "serialize" ONLY the current updated item and
      // then perform the AJAX HTTP request

      // alert($jQ("#sortable_list").sortable("serialize"))
      ...
    }
  });
  $jQ( "#sortable_list" ).disableSelection();
});

HTML code

<ul id="sortable_list">
  <li class="ui-state-default" id="key_1"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span>Item 1</li>
  <li class="ui-state-default" id="key_2"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span>Item 2</li>
  ...
</ul>

For istance, if I change the item position related to the id="key_2" I would like to serialize just that data to key=2 (note: generally the serialize method generates data like key=1&key=2&...). Furthermore, I would like to include the current\new position of that item (eg: new_position=1). Finally, I would like to perform the AJAX HTTP request including those parameters: <URL_string>?key=2&new_position=1.

  • 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-26T10:58:25+00:00Added an answer on May 26, 2026 at 10:58 am

    Tested it http://jsfiddle.net/kRsCE/

    $jQ(function() {
      $jQ("#sortable_list").sortable({
        placeholder: "ui-state-highlight",
        update: function(event, ui) {
            var itemid = $(ui.item).attr('id');
            var position;
            $jQ("sortable_list > li").each(function(index) {
                if($(this).attr('id') == itemid) {
                   position = index;
                   return;
                }
            });
            $.post('yourajaxscript', '&key='+itemid+'&new_position='+position, function(data) {
                //handle response
            });
        }
      });
      $jQ( "#sortable_list" ).disableSelection();
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Jqueryui connected sortable lists and I would like to drop elements only
i am using this jquery to make a drag and drop sortable list. http://jqueryui.com/demos/sortable/
I am using jQueryUI 1.8.14 and I would like to understand how to use
I would like to mimic a standard JavaScript confirm() using a jQueryUI dialog. I
I am using jqueryui.com's autocomplete function and I would like it to add the
I have a question, Im using jquery, jqueryui and basic ajax. I would like
I am using Ruby on Rails 3.1.1 and jQueryUI 1.8.14. I would like to
I'm using this plugin: http://jqueryui.com/demos/autocomplete/#remote Works great but I would like to use the
I am using Jquery UI buttons ( http://jqueryui.com/demos/button/ ). I would like to know
I am developing an application using jQueryUI. I am also using the Themeroller. I

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.