Skip to content
Advertisement

Delete a HTMLtable row using AJAX

  • Frameworks used: JavaScript, AJAX, HTML. Cannot use JQuery

  • Have to display SQL table on page

  • Last column of the table should contain an image which acts like a delete button

  • On clicking that delete image, the row should be deleted from HTML table and SQL table

  • In my code the onClick is not working

HTML code

table rows displayed by looping through rows of sql query result.

JavaScript

JavaScript code

JavaScript

PHP Code

file name: remove.php

JavaScript

Advertisement

Answer

Seems like you might have made things a bit too complicated. Let’s assume you’ve the following table:

JavaScript

Inside a <script> tag at the bottom of your HTML document, or in a separate file, you might want to try:

JavaScript

See also:

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement