Skip to content
Advertisement

Laravel yajra/Datatables action delete is not working

hy, i’m now using L5 and yajra/datatables plugin, everything work fine until i create delete button to delete record, the delete button is not working
here is my controller :

JavaScript

Here is my JS :

JavaScript

the JS event for btn-delete[data-remote] is not working, it’s no return error in console, but nothing happen when i click it

Advertisement

Answer

Its maybe not working because one the moment you binding your click event on the table there isn’t any elements in it. And so its not possible to bind the click event on an element named .btn-delete[data-remote].

Maybe it works if you bind the click event on the table and let it trigger if clicked on .btn-delete[data-remote], like:

JavaScript
Advertisement