Skip to content
Advertisement

Symfony: pass parameter to Ajax url

I am trying to figure out how to enable/disable user with checkbox without page reload.

index.html.twig

JavaScript

UserController

JavaScript

Question

How can I set corresponding user id to enabledChange function and change checked state depending on user state?

Advertisement

Answer

You need to add quotes to your variables, and pass changePath as an argument:

JavaScript

then:

JavaScript

I hope this will help.

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