Zend Framework 2: Auto disable layout for ajax calls

前端 未结 8 1811
终归单人心
终归单人心 2020-12-16 13:26

An AJAX request to one of my controller actions currently returns the full page HTML.

I only want it to return the HTML (.phtml contents) for that particular action.

8条回答
  •  生来不讨喜
    2020-12-16 14:06

    I replied to this question and seems it maybe similar - Access ViewModel variables on dispatch event

    Attach an event callback to the dispatch event trigger. Once this event triggers it should allow you to obtain the result of the action method by calling $e->getResult(). In the case of an action returning a ViewModel it should allow you to do the setTerminal() modification.

提交回复
热议问题