Reordering items in an ordered list using Jquery, Ajax, PHP & Mysql
Posted on 2012-03-16
I'm currently developing a site using PHP/MySQL which is also using Jquery pretty extensively, and I need to add in functionality that allows the user to re-order items within an ordered list using drag and drop.
When list items are dragged and dropped to a new position within the ordered list -- I'd like to trigger an ajax function that updates the order of those list items in the MySQL database. My ordered list will have a structure similar to the following (where the dynamic record ID values will be appended each list items ID attributes):
I've achieved the functionality that I've described using Prototype & Scriptaculous in the past -- though I'd much prefer to use JQuery to accomplish this if possible. How would I accomplish something this using JQuery, PHP, and MySQL ?
One last note -- there will be multiple different ordered lists on the same page -- each with their own unique ID attributes assigned to them -- and each of those ordered lists will need to be sortable. Please advise on how I would accomplish this.