How to execute livewire methods from javascript

What seems to be the problem:

Steps to Reproduce:

Are you using the latest version of Livewire: yes

How to execute livewire methods from javascript, the truth is that I’m using the confirmation swal library because I want to ask if it deletes the registry and not, but I have done it in several ways and I think it is possible to execute the delete method from javascript

Use window.livewire.emit(‘eventName’)

Add a Listener for it in your component. Then, that Listener may call the method you want.

1 Like