I have a little issue, I'm developing web app where you can upload some photos, then I store metadates about photos in my DB and I generate a unique primary key to every photo as a "pointer" to my DB. Then I'm appending to photos dialog button, where you can modify metadates stored in DB. But my problem is, that I want to store in every button unique primary key value for photo. But when I upload 3 photos, I have 3 buttons and they all have a primary key set to the last photo uploaded. So I cannot modify first or second photo in DB.
Don't you have any advice or example how to solve my problem, please?
Thank you for your time.
Asked
Active
Viewed 24 times
1

Petr Bečka
- 774
- 3
- 16
- 39
-
@Amitesh code is kind of long so I made something like "simulation" - create button simulates uploaded photos so with click I generate dialog button where I'm trying to store my ID value( PK to DB ) - fiddle: https://jsfiddle.net/bimbochobot/7rr85xuw/3/ – Petr Bečka Jan 23 '16 at 12:25
1 Answers
1
I saw your code , it looking good only one fault is that , you are generating button like this :
<button id="change_coord">Change coordinates</button>
<button id="change_coord">Change coordinates</button>
<button id="change_coord">Change coordinates</button>
That is having save id , so try to give them different it. so,it will have different values, now it will only store last inserted value.
Read this links it will help you
read this link it will

Community
- 1
- 1

Amitesh Kumar
- 3,051
- 1
- 26
- 42
-
I'm not sure what exactly you mean. Like generate them with different id? This id="change_coord" should be different for all buttons? But how can I do that? – Petr Bečka Jan 23 '16 at 12:42
-
-
Sorry but another problem, when I generate buttons with different IDs I cannot use this: $(document).on("click", "#change_coord", function() { dialog.dialog( "open" ); }); – Petr Bečka Jan 23 '16 at 13:01