title: How do I delete a table row?
body: <p>I tried to make the following code work for the last 5-6 hours, but had no luck.</p>
  
  <p>Can anyone please help me understand what's wrong with this code? After clicking on the delete link nothing happens.</p>
  
  <p>Here is my table:</p>
  
  <pre><code>&lt;table id="links"&gt;
      &lt;tr id="record-&lt;?php echo $row['FeePaymentId']; ?&gt;"&gt;
          &lt;td&gt;&lt;?php echo $row['MasterEntryValue']; ?&gt;&lt;/td&gt;
          &lt;td&gt;&lt;?php echo $row['Amount']; ?&gt;&lt;/td&gt;
          &lt;td&gt;&lt;a href="#" class="delete"&gt;delete&lt;/a&gt;&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>Here is my JavaScript:</p>
  
  <pre><code>$('table#links td a.delete').click(function() {
      if (confirm("Are you sure you want to delete this row?")) {
          var id = $(this).parent().parent().attr('id');
          var data = 'id=' + id ;
          var parent = $(this).parent().parent();
  
          $.ajax({
              type: "POST",
              url: "DeleteRow.php",
              data: data,
              cache: false,
              success: function() {
                  parent.fadeOut('slow', function() {$(this).remove();});
              }
          });                
      }
  })
  </code></pre>