-1

I am trying to make a website where the user needs to pick one image from a selection presented on the site. When the user selects a picture, i.e. clicks on it, I somehow need to retrieve the name/ID of the selected photo, and have this available on the server.

This is because I must run a bash script on my server, with the selected image ID as input.

What is the simplest way this can be achieved?

apples-oranges
  • 959
  • 2
  • 9
  • 21
  • 1
    It is expected that you at least attempt to code this for yourself. Stack Overflow is not a code writing service. I would suggest that you do some additional research, either via Google or by searching SO, make an attempt and. if you still have trouble, come back with **your code** and explain what you have tried and why it did not work. – Paulie_D Dec 27 '15 at 00:59
  • Can include `html` at Question ? – guest271314 Dec 27 '15 at 01:03
  • @Paulie_D My apologies. – apples-oranges Dec 27 '15 at 15:39

1 Answers1

0

Here's how to find the id of the element you clicked ...

$(document).ready(function() {
  $(".some-image").click(function(event) {
    // do something with the  image id below
    console.log(event.target.id);
  });
});

Copied almost entirely from this stack-overflow question/answer here

Community
  • 1
  • 1
MilesStanfield
  • 4,571
  • 1
  • 21
  • 32