John Garreth
John Garreth

Reputation: 1132

How to keep IDs unique for Ajax-programming?

It seems to me that most things in Ajax-programming are solved by "inventing" IDs. The problem that might occur is, to keep the IDs unique. How do you solve the problem (for example when managing a list of messages, …)? By generating long randomized strings?

Upvotes: 1

Views: 47

Answers (1)

Mitch Satchwell
Mitch Satchwell

Reputation: 4830

If these messages correspond to something server-side in a database, you should use the ID from the database (if they don't have a unique identifier in the database, they should).

If they exist solely on the client, you can use numerical IDs and increment each time.

Upvotes: 1

Related Questions