Hector Virgen said: > When using the JSON context with the ContextSwitch helper, all view > variables are returned in the JSON response. So the easiest thing to do is > to provide the FlashMessenger messages to the view.
> Add one of these lines in your controller's action method: > // Get messages stored during previous request: > $this->view->flashMessages = $this->getMessages(); > // Get messages stored during current request: > $this->view->flashMessages = $this->getCurrentMessages(); > Or you can use array_merge() to merge both of them together. Renan de Lima said: >1. create a controller plugin, in postDispatch() operation get messages and put them in the responser header Thanks! I was able to send the messages to the view from a postDispatch function in my controller. Ideally I'd like to combine both of these ideas - is there a a way to have a controller plugin send the messages to the view? I'd like the messages to be in the JSON response, rather than the header. I was able to create a plugin and get the messages, but I'm not sure how to send them to the view? -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/How-can-I-inlude-flashMessenger-messages-in-JSON-context-tp3301296p3301699.html Sent from the Zend Framework mailing list archive at Nabble.com.
