I'm building a website which allows the user to drag elements on to the screen using JavaScript and jQuery. I would like to store these elements inside a database, and then draw them back on to the screen when they visit the website again.
Each element will need a unique id, this will be used when performing a few functions such as addComment(id), editElement(id).
An id count is going to be incremented every time an element is added, and this id count will be assigned to the element which has been created e.g.
- 1st element id = 1
- 2nd element id = 2... etc
What would be a secure method of persistently keeping track of this id count? it needs to be used client and server side.
I'm not sure why this is being down voted, it's a pretty clear question.
Solution: I'm going to store the element id's and the total number of elements in a database, each time an element is created an ajax call will be used to assign the id to that element (which will be the element type concatenated with the number of previously created elements) and then store it in the database.