Passing parameters from view to controller

前端 未结 2 1095
礼貌的吻别
礼貌的吻别 2020-12-03 08:21

I got a bit of a newbie question. I\'m trying to pass a variable from my view to my controller. Is there anyway my method in my controller can receive variables from my view

2条回答
  •  自闭症患者
    2020-12-03 08:44

    When a request comes in, the controller (and any model calls) will be processed first and then the view code gets processed last. The view can call methods in the helpers, but can't reference functions back in the controller.

    However, once a page is rendered, you can either post information back to the controller as part of a new request or use ajax/JQuery (etc) to make a call to a controller function remotely.

    Does that help?

提交回复
热议问题