title: PHP doesn't get the id attribute variable from JQuery
body: <p>Okay so I have a mysql table (with id, name, photo, etc.) that shows an image for each id. When I click on each image, it opens a modal, which I want to display the name from the given id.</p>
  
  <pre><code>&lt;input type="image" src="imatges/&lt;?php echo $row['foto']; ?&gt;" id="&lt;?php echo $row['id']?&gt;" class="img-rounded image" width="250px" height="200px" data-target="#myModal"/&gt;
  </code></pre>
  
  <p>The problem is that I try to get the image id using Jquery then pass it to php so that it can show the name on the modal, but it doesn't work. It says "no" instead. How can I fix this? Thanks in advance.</p>
  
  <pre><code>&lt;!-- Modal --&gt;
          &lt;div class="modal fade" id="myModal" role="dialog"&gt;
              &lt;div class="modal-dialog"&gt;
  
                  &lt;!-- Modal content--&gt;
                  &lt;div class="modal-content"&gt;
                      &lt;div class="modal-header"&gt;
                          &lt;button type="button" class="btn close" data-dismiss="modal"&gt;X&lt;/button&gt;
  
                          &lt;?php
                          $id = isset($_POST['id']);
                          if(!$id){
                              echo "no";
                          }
  
                          $prepIexec2 = $conn-&gt;prepare('SELECT nom FROM TaulaGats WHERE id = :id');
                          $prepIexec2-&gt;bindParam(':id', $id);
                          $prepIexec2-&gt;execute();
  
                          while($row = $prepIexec2-&gt;fetch(PDO::FETCH_ASSOC)){
                              extract($row);
                          ?&gt;
  
                          &lt;h4 class="h4"&gt;&lt;span&gt;&lt;/span&gt;&lt;?php echo $row; } ?&gt;&lt;/h4&gt;
  </code></pre>
  
  <p>Jquery</p>
  
  <pre><code>$(document).ready(function(){
                  $(".image").click(function(){
                      var id = $(this).attr('id');
                      $.ajax({
                          type: "POST",
                          data: { id: id },
                          success: function (result) {
                              $("#myModal").modal();
                          }
                      });
                  });
              });
  </code></pre>