There are many things you can do with AJAX to improve the user experience, for example, Add, edit or delete the record and update layout without reloading the page.
With only PHP you can easily delete records but require to submit the page or send value by URL and according it delete record.
This works and removes the record but it reloads the page every time.
You can do this with jQuery AJAX where you need to pass the record id from AJAX which need to delete.
In the demonstration, I am creating the HTML table which shows the list of records with a delete button. When the button gets clicked then remove record and also remove HTML table row with fadeOut() effect.
In PHP, you can simply use unlink() function this removed a file from your server if it exists.
Sometimes you have the requirement to delete a resource file without reloading the page.
For demonstration purpose, I create a some <img> element with Delete Button. When the Button gets clicked then remove the file using jQuery AJAX and replace the <img> source with the default image.