title: How to display a dialog when user clicks on a <img>?
body: <p>Here's what I've made so far:</p>
  
  <pre><code>// somewhere in the page code...
  &lt;img alt="" src="images/frame.png" onclick="uploadImage()" /&gt;
  </code></pre>
  
  <p>I have created a jQuery script:</p>
  
  <pre><code>// in the head section of the page...
  &lt;script type="text/javascript"&gt;
      $('#uploadContactImage').dialog({
          title: 'Change contact image',
          buttons: {
              "Upload new image": function() {
                  $(this).dialog("close");
              },
              "Remove current image": function() {
                  $(this).dialog("close");
              },
              "Cancel": function() {
                  $(this).dialog("close");
              }
          }
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>Finally, I have a javascript file with the empty function: </p>
  
  <pre><code>function uploadImage() {
  }
  </code></pre>
  
  <p>The use case should be: User clicks the image, the dialog pops up. Based on the button the user has clicked, certain functions should be called. </p>
  
  <p>Please note that my image tag is generated through AJAX, i.e. the jQuery script is not connected to it. That's the first problem. </p>
  
  <p>The second problem is that I don't know how to call the jQuery script to actually display the dialog. </p>
  
  <p>The third and the last problem is that I don't know how to handle the choice the user makes. </p>
  
  <p>As you must have concluded by now, I am a complete newbie when it comes to jQuery. Can you help me out to get started? Thanks. </p>