title: jQuery ajax DELETE not working
body: <p>The following part of my code doesn't work: </p>
  
  <pre><code>           $("body").on("click", "a", function(){
  
                  var ID = $(this).attr("id");
                  $.ajax({
                      url: url + '?' + $.param({"id": ID}),
                      type: 'DELETE',
                      success: function(){alert("Entry deleted");}
                  });
  
              });
  </code></pre>
  
  <p>More specifically, it's the ajax request that isn't working. No alert-message is shown after clicking on one of the "Delete" links, so apparently the ajax-request wasn't successful.</p>
  
  <p>The whole code looks as follows (for some context): </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="de-DE"&gt;
    &lt;head&gt;
      &lt;meta charset="UTF-8" /&gt;
      &lt;style&gt;
        body {
          font: 15px normal Arial, sans-serif;
          color: #000000;
        }
        label {
          width: 5em;
          display: inline-block;
        }
        ul {
          padding: 0;
        }
      &lt;/style&gt;
      &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"&gt;
      &lt;/script&gt;
      &lt;script&gt;
        $(document).ready(function(){
  
          var url = "https://vsr.informatik.tu-chemnitz.de/edu/2015/evs/exercises/jsajax/guestbook.php";
  
          /******Code to show the content of the server file: *******************/            
            $.get(url, function(data){
  
            var table = document.createElement("table");
            $("body").append(table);
            var tbody = document.createElement("tbody");
            $("table").append(tbody);
  
            for(var i=0; i&lt;data.length; i++){
              $("tbody").append("&lt;tr&gt;&lt;td&gt;" + data[i]["name"] + "&lt;/td&gt;&lt;td&gt;" + data[i]["text"] + "&lt;/td&gt;&lt;td&gt;&lt;a id=\"" + data[i]["id"] + "\" href=\"\"&gt;Delete&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;");  
            }
  
          });
          /****************************************************************************
  
            *****Code to delete an entry (with a specified id) in the server file:****/ 
  
              $("body").on("click", "a", function(){
  
              var ID = $(this).attr("id");
              $.ajax({
                url: url + '?' + $.param({"id": ID}),
                type: 'DELETE',
                //success: function(){$(this).closest("tr").remove();}
                success: function(){alert("test");}
              });
  
            });
  
          /**********************************************************************/
  
  
        });          
      &lt;/script&gt;
    &lt;/head&gt;
    &lt;body&gt;
      &lt;h1&gt;Guestbook&lt;/h1&gt;
      &lt;ul&gt;
        &lt;li&gt;&lt;b&gt;TestUser:&lt;/b&gt; This is an example entry. &lt;a href="#" alt="Delete entry"&gt;(X)&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;b&gt;TestUser2:&lt;/b&gt; This is another example entry. &lt;a href="#" alt="Delete entry"&gt;(X)&lt;/a&gt;&lt;/li&gt;
      &lt;/ul&gt;
      &lt;hr&gt;
      &lt;form method="POST" action="https://vsr.informatik.tu-chemnitz.de/edu/2015/evs/exercises/jsajax/guestbook.php"&gt;
        &lt;label for="name"&gt;Name&lt;/label&gt; &lt;input id="name" type="text" name="name" placeholder="Name"&gt;&lt;br&gt;
        &lt;label for="text"&gt;Text&lt;/label&gt; &lt;input id="text" type="text" name="text" placeholder="Text"&gt;&lt;br&gt;
        &lt;button type="submit"&gt;Add entry&lt;/button&gt;
      &lt;/form&gt;
    &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>*****************************UPDATE***************************</p>
  
  <p>Here's a screenshot from the network-part of my Developer-Tools after pressing one of the "Delete"-links:</p>
  
  <p><a href="https://i.stack.imgur.com/CAbUO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CAbUO.png" alt="enter image description here"></a></p>
  
  <p>If I'm not mistaken, there aren't any error messages shown anywhere ... </p>