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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T03:31:48+00:00 2026-06-09T03:31:48+00:00

I have a page with multipe jquery sortable lists, each of these lists has

  • 0

I have a page with multipe jquery sortable lists, each of these lists has an sp_id, how do I pass this to my script?

  <script type="text/javascript">

$(function() {
    $(".sortable").sortable({ opacity: 0.6, cursor: 'move', update: function() {
        var order = $(this).sortable("serialize", "placeholder") + '&action=updateRecordsListings&sp_id=' + ???;            
     $.post("updatedb.php", order, function(order) {
          alert(order);
        });
        }
    });
});

I am guessing I should put a sp_id field of some kind in each sortable ul

 <ul class="sortable"
-- ?? Some field with the sp_id ?? -- 
 <li class="ui-state-default">Item 1</li>
<li class="ui-state-default">Item 2</li>
 </ul>
  • 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-06-09T03:31:51+00:00Added an answer on June 9, 2026 at 3:31 am
    var variable_to_pass = 45;
    $('.sortable').attr('spid', variable_to_pass);
    

    Put that in a document ready or click function? or if your rending your HTML including the .sortable element just add that to the ul. Guess it all depends on how your working with what, from what end.

    <ul class="sortable" spid="<?php echo $myvariable; ?>">
    

    to get the value for posting via jQuery..

    var myVar = $('.sortable').attr('spid');
    

    Alternatively you could also get the index of each on load and append them similar to the LI’s.

    $('.sortable li').each(function(){
        $(this).attr('spid', $(this).index());
    }
    

    then when you post to your ajax you run a similar function over all of them to get all there spid values. It can get really intricate if you let it hope it helps

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this JQuery function: $(document).ready(function() { $(div.descript_long).each(function() { var descript_length = $(div.descript_long).text().length; if(descript_length
I have the following in jQuery mobile: <script type=text/javascript> $(#locate_results).live(pageinit, function(event) { $(#venues li
I have a page that has multiple select lists and when ever one of
I'm new to jquery and I have a page with multiple unordered lists ul.
I have multiple lists on one page (multiple categories of products) like this: <h3>Category
I have a page with multiple forms on it. Each form has it's own
I have a page with multiple textboxes and each has a button associated with
I have a page that has multiple sliders (from http://www.switchonthecode.com/tutorials/using-jquery-slider-to-scroll-a-div ) and since each
I have a page that has multiple selectors. Each has an on click event.
I have an ASP.NET MVC page with multiple partial sections. Each of these sections

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.