title: delete function in ajax doesnt work
body: <p>I'm trying to use Ajax to delete a row from mysql without refreshing ,but script doesn't work.</p>
  
  <pre><code>// ============ delete.php ===========
  if(isset($_GET['delete_id'])) {
      $id = $_GET['delete_id'];
      $dquery = "SELECT url FROM test1 WHERE id='$id'";
  
      foreach($db-&gt;query($dquery) as $deleterow){
          deleteDirectory("test1/" . $deleterow['url']);
      }
  
      $result = $db-&gt;query("DELETE FROM test1 WHERE id ='$id'");
  }
  
  // ============ manage.php ===============
      while($row = $q-&gt;fetch(PDO::FETCH_ASSOC)){
        $id1 = $row["id"];
         echo '
          &lt;tr&gt;
  
              &lt;td&gt;'.$row["name"].'&lt;/td&gt;
              &lt;td&gt;'.$row['subscribers'].'&lt;/td&gt;
              &lt;td&gt;&lt;a href="#"&gt;&lt;/a&gt;&lt;/td&gt;
        &lt;td&gt;&lt;input type="submit" class="delete" id="'.$id1.'" value="Delete"&gt;&lt;/td&gt;
          &lt;/tr&gt;
          ';
      }
  
  &lt;script type="text/javascript" &gt;
  $(document).ready(function(){
   $(".delete").click(function(){
     var del_id = $(this).attr('id');
     $.ajax({
        type:'POST',
        url:'delete.php',
        data:'delete_id='+del_id,
        success:function(data) {
          if(data) {   alert(del_id);
            $("body").load("manage.php");
          } else { alert("Error"); }
        }
     });
   });
  });
   &lt;/script&gt;
  </code></pre>
  
  <p>I also tried to include manage.php into delete.php and use $id1 , and worked, but they delete another id</p>