The problem is the following. There is a project list which is sorted by position. Necessary to change the position when you press the UP or DOWN button, and using Ajax to send data to the server for updates (in fact the principle of drag & Drop).
The idea is easy, but since face for the first time enter the stump.
Tried to solve as follows. After transferring the project to the top, I collect the positions of all projects and send to the server...
A piece of code in rapydscript http://pastebin.com/dM7PSi29
Compiled following http://pastebin.com/aycQgjEk
On the server side, the following occurs http://pastebin.com/3A9kKqtQ
The output is not getting correctly sorted list of projects. How do you solve such tasks? Please help