Calling javascript function in controller

Is there a way to call a javascript function through controller?

What are you trying to accomplish, and how are you envisioning this would work? If you included some kind of external NodeJS runtime or something you could call it and have it evaluate a JS function. Are you trying to run JS code in a client’s browser?

1 Like

Javascript is run in a Javascript virtual machine, whether nodejs on the server or on the client. The controller cannot ‘run’ either, however it can dispatch a port request to run it locally on nodejs or you can send it via the template to run on the client ‘after’ the controller runs.

What are you trying to do though?

1 Like