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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T05:36:07+00:00 2026-05-21T05:36:07+00:00

firstly bear with me this might not come out the way i intend it

  • 0

firstly bear with me this might not come out the way i intend it to :p

I am working on a little personal project. I have a web page with 3 lists on it in seperate divs. on the load of the page there is a php script which reads from the database table and puts data in these lists depending on the a value in a column in the resultset.

Then on the page the user is able to drag and drop the data from one list to another using some javascript html 5 stuff.

What i would like to happen is a save button or something which will then update the database so that the next time the page is loaded the lists will be in the same state as after the user dragged them about

problem is i can not work out any way in which to store the data back to the database – the whole server side client side thingy!

Any suggestions? i am open to all if i need to learn a new coding language to make it happen then so be it 🙂

Vade

  • 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-21T05:36:07+00:00Added an answer on May 21, 2026 at 5:36 am

    You simply have to send the new order back to the server using AJAX.

    Assuming your HTML looks like that:

    <div id="FirstList"><ul>
      <li>Item 2</li>
    </ul></div>
    <div id="SecondList"><ul>
      <li>Item 1</li>
      <li>Item 4</li>
    </ul></div>
    <div id="ThirdList"><ul>
      <li>Item 3</li>
    </ul></div>
    <input type="button" id="save_btn" value="save"/>
    

    Using jQuery it’s quite simple:

    function saveStuff() {
        var data = {};
        // for each list
        for(var name in {'FirstList':1,'SecondList':1,'ThirdList':1}) {
            data[name] = [];
            // for each li in the list
            $('#'+name+' li').each(function() {
                // fill data with item text content (you can change that)
                data[name].push($(this).text());
            }
        }
        // then send the new order to the server (with AJAX in JSON)
        $.post('save.php',
               {data: JSON.stringify(data)}, 
               function(){ alert('Data saved!'); }, 
               'json');
    }
    
    $(function(){
        // register the handler on the button
        $('#save_btn').click(saveStuff);
    });
    

    In save.php:

    $data = json_decode($_POST['data']);
    $data['SecondList'][1]; // contains "Item 4"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Firstly this has turned out to be quite a long post so please bear
firstly i recently installed this program as I’m working on a project to create
(Firstly, as a disclaimer, this is related to an assignment. I'm not asking anyone
Firstly, please forgive me if I have asked this before (i suffer memory problems
Firstly, the title was the best I could come up with. I have written
Firstly my maths is limited, so this question may have a simple answer. So,
Firstly, I'm not using rails. This is vanilla ruby application. I've read about packaging
Firstly, I have search Stack Overflow for the answer, but I have not found
Firstly, very sorry if this is not a true stackoverflow question. But it's something
Firstly appologies for the poor title, not sure how to explain this in one

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.