I'm not as strong on JQuery as I'd like to be so hope this all makes sense but I'd appreciate some guidance on the best way to go about the following project.
I'm working on a cms based website for writers and would like them to be able to reorder the chapters of a book. So, using php, they would be able to view the first 100 characters from each of the chapters they have written. Now what I'd like to do is for each of these chapters to be draggable with a jquery script and if they drop chapter 3 above chapter 2, the database will automatically be changed so that the chapter_id of 3 changes to 2 and all other chapters are incremented by 1.
I'm not looking for a complete solution, just some general pointers on the best scripts or methodologies to research.
Many thanks in advance for any tips.
This problem can be broken into two smaller ones:
- Make an element on a web page draggable using jQuery with an event firing when dragging stops
- Update a MySQL database using jQuery
If you don't mind using plugins, I would recommend Draggable.
Here's a demonstration of everything you need to accomplish the first part: http://jqueryui.com/draggable/#events
Therefore you will need to look into pairing jQuery with PHP and MySQL.
Here is a tutorial to get you started: http://technotip.com/2208/insert-data-into-mysql-jquery-ajax-php/
Apprciate you taking the time to reply with such useful info - I'll look into them.
This topic is now closed. New replies are no longer allowed.