Save the position of a Dropped element

I’m working on creating something similar to igoogle. The idea is that
a user can drag an element anywhere on the page at which point the
elements position will be stored in the database and be used to place
the element in that spot whenever the page is loaded.

I’m having trouble figuring out:

  1. How to get the elements position
  2. How to set all the elements to the correct position when rendering
    the page.

Thanks in advance.