title: Deleting mySQL Table Row with jQuery Ajax
body: <p>I'm trying to make it so when I click a span icon it will send the article_id to my php sql page which deletes my article, I'm using jQuery Ajax to send the id, the id sends alright on the jQuery side but after the http post request is done my table row is still there, can anyone see if somethings wrong with my code, thanks in advance!</p>
  
  <pre><code>    &lt;?php
          $sql_categories = "SELECT art_id, art_title, art_company, art_cat_id, art_sta_id, art_date, art_rating, art_price, cat_id, cat_name, sta_id, sta_name
                  FROM app_articles LEFT JOIN app_categories
                  ON app_articles.art_cat_id = app_categories.cat_id
                  LEFT JOIN app_status
                  ON app_articles.art_sta_id = app_status.sta_id
                  ORDER BY art_order ASC"; 
  
              if($result = query($sql_categories)){
                  $list = array();
  
                  while($data = mysqli_fetch_assoc($result)){
                      array_push($list, $data);
                  }
  
                  foreach($list as $i =&gt; $row){ 
                  ?&gt;
                      &lt;div class="row" id="page_&lt;?php echo $row['art_id']; ?&gt;"&gt;
                          &lt;div class="column one"&gt;
                              &lt;span class="icon-small move"&gt;&lt;/span&gt;
                              &lt;a href="edit-article.php?art_id=&lt;?php echo $row['art_id']; ?&gt;"&gt;&lt;span class="icon-small edit"&gt;&lt;/span&gt;&lt;/a&gt;
                              &lt;span id="&lt;?php echo $row['art_id']; ?&gt;" class="icon-small trash"&gt;&lt;/span&gt;
                          &lt;/div&gt;
                          &lt;div class="column two"&gt;&lt;p&gt;&lt;?php echo $row['art_title']; ?&gt;&lt;/p&gt;&lt;/div&gt;
                          &lt;div class="column two"&gt;&lt;p&gt;&lt;?php echo $row['art_company']; ?&gt;&lt;/p&gt;&lt;/div&gt;
                          &lt;div class="column two"&gt;&lt;p&gt;&lt;?php echo $row['cat_name']; ?&gt;&lt;/p&gt;&lt;/div&gt;
                          &lt;div class="column one"&gt;&lt;p&gt;&lt;?php echo $row['art_date']; ?&gt;&lt;/p&gt;&lt;/div&gt;
                          &lt;div class="column one"&gt;&lt;p&gt;&lt;?php echo $row['art_rating']; ?&gt;&lt;/p&gt;&lt;/div&gt;
                          &lt;div class="column one"&gt;&lt;p&gt;&lt;?php echo $row['art_price']; ?&gt;&lt;/p&gt;&lt;/div&gt;
                          &lt;div class="column one"&gt;&lt;p&gt;&lt;?php echo $row['sta_name']; ?&gt;&lt;/p&gt;&lt;/div&gt;
                          &lt;div class="column one"&gt;&lt;a href=""&gt;&lt;span class="icon-small star"&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
                      &lt;/div&gt;
                  &lt;?php
                  }
              }
              else {
                  echo "FAIL";
              }
          ?&gt;
  
  
  jQuery
  
          $(document).ready(function(){
  
                  $(".trash").click(function(){
  
              var del_id = $(this).attr('id');
  
              $.ajax({
                  type:'POST',
                  url:'ajax-delete.php',
                  data: 'delete_id='+del_id,
                  success:function(data) {
                      if(data) {
  
                      } 
                      else {
  
                      }   
                  }
  
              }); 
          });
  
      });
  
  
  PHP mySQL Statement
  
      if(isset($_POST['delete_id'])) {
  
          $sql_articles = "DELETE FROM app_articles WHERE art_id = ".$_POST['delete_id'];
  
          if(query($sql_articles)) {
              echo "YES";
          }
          else {
              echo "NO";
          }
      }
  else {
      echo "FAIL";
  }
  
  
  ?&gt;
  </code></pre>