Delete Table Rows Using PHP JQuery Ajax

Today, We want to share with you Delete Table Rows Using PHP JQuery Ajax.In this post we will show you Animated AJAX Record Deletion Using jQuery, hear for add edit and delete record using php mysql we will give you demo and example for implement.In this post, we will learn about Add, Edit And Delete Records Using jQuery, Ajax, PHP And MySQL with an example.

Delete Table Rows Using PHP JQuery Ajax

There are the Following The simple About Delete Table Rows Using PHP JQuery Ajax Full Information With Example and source code.

Read Also:  Group By with Sum using Laravel Collection

As I will cover this Post with live Working example to develop live table edit with jquery and ajax php, so the PHP Remove Table Row Using Ajax for this example is following below.

Step 1: The PHP – Content & Header Part

include the Top of the page(jquery-record-delete.php)

if(isset($_GET['delete'])) {
  $rows = mysql_query('DELETE FROM products WHERE product_id = '.(int)$_GET['delete'],$link);
}

Step 2: HTML Part

display the records using MySQL

$rows = mysql_query('SELECT * FROM products ORDER BY title ASC',$link);
while($row = mysql_fetch_assoc($rows)) {
  echo '<div class="record" id="record-',$row['product_id'],'">
        <a href="?delete=',$row['product_id'],'" class="delete">Remove</a>
        <strong>',$row['title'],'</strong>
      </div>';
}

Step 3: The jQuery JavaScript

jQuery triggers the AJAX request

$(document).ready(function() {
  $('a.delete').click(function(e) {
    e.preventDefault();
    var row_parent = $(this).parent();
    $.ajax({
      type: 'get',
      url: 'jquery-record-delete.php',
      data: 'ajax=1&delete=' + row_parent.attr('id').replace('record-',''),
      beforeSend: function() {
        row_parent.animate({'backgroundColor':'#c60000'},400);
      },
      success: function() {
        row_parent.slideUp(400,function() {
          row_parent.remove();
        });
      }
    });
  });
});

Angular 6 CRUD Operations Application Tutorials

Read :

Read Also:  Laravel 5/6/7 create custom facade

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Delete Table Rows Using PHP JQuery Ajax.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.


Related FAQ

Here are some more FAQ related to this Article:

  1. Read Also:  how to create dynamic calendar in html?
  2. Read Also:  sql join multiple tables
  3. Read Also:  PHP Try Catch Exception & Error Handling Tutorial
  4. Read Also:  Create Contact Form Sending Email via SMTP PHPMailer
  5. Read Also:  Laravel AJAX Live Search Example
  6. Read Also:  How to add Bootstrap Tooltip Plugin Example
  7. Read Also:  Add custom text to image in Laravel with Example
  8. Read Also:  Group By with Multiple Columns using Laravel Collection
  9. Read Also:  JavaScript Automatically Page Redirection
  10. Read Also:  how to insert data using ajax in laravel with datatables?
CLOSEX