title: How can I transmit a dynamic id (php) to javascript?
body: <p>I have created an image gallery with PHP. The user can delete each image: Clicking the button "<strong>Delete this Image?</strong>" will show him an image-overlay with 2 buttons "<strong>Delete</strong>" and "<strong>Cancel</strong>". The "<strong>Cancel</strong>"-button will hide the overlay. </p>
  
  <p>Each image has it own ID. Now I want replace the "<strong>NAME-OF-IMG-WITHOUT-EXTENSION</strong>" in JavaScript with the ID created by PHP. Unfortunately, I do not know how to pass the ID to the Script... Here are the relevant code-areas:</p>
  
  <pre><code>&lt;script&gt;
  $(document).ready(function(){
      $("#overlay_hide_" + "NAME-OF-IMG-WITHOUT-EXTENSION").click(function(){
          $(".overlay").fadeOut("fast");
      });
      $("#overlay_show_" + "NAME-OF-IMG-WITHOUT-EXTENSION").click(function(){
          $(".overlay").fadeIn("fast");
      });
  });
  &lt;/script&gt;
  
  &lt;div class="overlay"&gt;
  &lt;a class="button_delete" onclick="deleteImage('&lt;?php echo $filename['basename']; ?&gt;')"&gt;Delete&lt;/a&gt;
  &lt;a class="button_cancel" id="overlay_hide_&lt;?php echo $filename['filename']; ?&gt;"&gt;Cancel&lt;/a&gt;
  &lt;/div&gt;
  
  &lt;img src="&lt;?php echo $filename['basename']; ?&gt;" /&gt;
  &lt;a id="overlay_show_&lt;?php echo $filename['filename']; ?&gt;"&gt;Delete this Image?&lt;/a&gt;  
  </code></pre>