i solve this in the other way, via http headers, two steps

1. create a controller plugin, in postDispatch() operation get
messages and put them in the responser header

2. append in you ajax component a ajax listener (in jQuery is
"compete" setting) and read http response in you client side [1]

so you have messages available in your views, through helper or ajax requests

it's less intrusive and works fine with every component you want plug
in your application

[1] if possible create a component, make possible to configure message
callback to parse them

--
Renan de Lima Barbosa



On 11 February 2011 13:26, Hector Virgen <[email protected]> wrote:
> 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.
>
> --
> *Hector Virgen*
> Sr. Web Developer
> http://www.virgentech.com
>

Reply via email to