how to call function in another controller?

85 views
Skip to first unread message

mrjayviper

unread,
Aug 6, 2021, 12:52:57 AM8/6/21
to CFWheels
maybe best explained with an example:

functionX inisde controller2.cfc returns JSON via renderwith. At the moment, I am calling functionX via an HTTP request.

I want to call/invoke functionX/controller2 inside controller1.cfc. I know I can use an HTTP request to do it but I'm wondering if there's a way to do without resorting to that.

Thanks!

Risto

unread,
Aug 6, 2021, 1:09:40 PM8/6/21
to CFWheels
If you want to use a function in more than one controller I would move that function to /global/functions.cfm or into Controller.cfc as the other controllers extend this.
Reply all
Reply to author
Forward
0 new messages