Skip to content
Advertisement

Cann’t delete row in php using AJAX

I am deleting row in PHP using AJAX, but it shows Row can’t delete. My Delete button is like this…

JavaScript

I call a function on the click button. Function like this. It always Executes part can’t delete. I think there is a problem with

JavaScript

I think there is a problem with Data… but I can’t resolve it.

JavaScript
JavaScript

And My PHP file is in another directory like this

JavaScript

My table is like

JavaScript

Advertisement

Answer

The first problem is that, you’re getting name attribute from your delete button. You can pass bni_member_id as a data attribute instead of using element id attribute. It can cause confusion.

And the second problem is that, you’re using both onlick attribute and jQuery’s click method. Using one them is pretty enough. Your input button will look like this:

JavaScript

Then your js will look like this:

JavaScript

I hope this helps you.

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