title: Posting a variable to a PHP File with Ajax to delete a row from Mysql - doesn't work
body: <p>here's my Ajax function.:</p>
  
  <pre><code>$( document ).ready(function(){
    $("#deletebutton").click(function(){
      var del_id  = $(this).attr('name');
      var answer = confirm ("Are you sure?");
      if (answer)
  
         $.ajax({
             type: "POST",
             url: "deletescript.php",
             data:'delete_id='+del_id,
                  success: function(data)
                  {
                     alert("Done!");
                  }
             });
     });
  });
  </code></pre>
  
  <p>And here's the affected button:</p>
  
  <pre><code>echo'&lt;input type="button" name="'.$id.'" id="deletebutton" value="delete"&gt;'
  </code></pre>
  
  <p>Here's my PHP Script called <strong>deletescript.php</strong>:</p>
  
  <pre><code>$id = $_POST['delete_id'];
  $query = "DELETE from items where id = '$id'";
  $result = $mysqli-&gt;query($query);
  </code></pre>
  
  <p>Even when I get "Done!" as an alert - my Item still exists. I also checked with Firebug that the correct ID is succesfully sent to the deletescript.php file. What do I have to do? I also tested the SQL-Query manually on my Databse and it worked. Searched for similar questions and found some, sadly even their solutions didn't help. I don't know what to do...
  Thank you!</p>