Skip to content
Advertisement

Laravel – Toggle value in database with checkbox and ajax

I want to toggle a boolean value in my table with a checkbox through jquery and ajax.

So whenever a user ticks the the checkbox it should toggle the value in table.

So far i came up with this but i need help:

JavaScript

Advertisement

Answer

The only thing I’d modify would be returning an answer to the ajax call to let it know what’s happening.

JavaScript

JavaScript

jQuery Ajax documentation

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