How to store the image into mysql database while dragging that image using Ajax

I am doing memory site and following is the link of my site

On that, If user select the seconds and cards, it display the no of cards that he selected for selected seconds. Then it display the cards in randomwise. The user has to drag the cards in order. I already insert the dispalyed order. I have to insert the dragged order in database. Then only I show the result. Can anyone help me.

Reference site is www.memorise.org/flashcards.html