how to update two html fields in a single ajax requests

how can i update two html fields by using single ajax requests…

I posted same issue some time ago. What I did was creating a wrapper that render lines of javascript as part of the reply to update other object into the page if they exists. To help this process I’m using a pagestate stored into the session/cookies/hidden to be sure that porlets or widgets are presento into the page.


MyHelper::updateDIV("divID","some html here");


Those are called during an ajax request handling and the effect is appending js lines of code wrapped into a <script>.

I was looking to have a more "component" approach like I was used in Prado but this is the cleaner thing I was able to create.

Another interesting approach is using JQuery javascript events and put on widgets js code to handle custom events to make them acting in async mode.

This sends the event and arguments.

var event = jQuery.Event("refreshAllNews");

event.data1 = "foo";

event.data2 = "bar";


Call back on widgets

$("#myPortlet").bind("refreshAllNews", function(e, eventData){

  // send Ajax action or use eventData parameter


This can be very usefull also to "broadcast" events to all page objects interested.


could u provide me a simple example