update mutliple id

Hi Guys,

There’s a way to update multiple id at once with Ajax ?

ex:




echo CHtml::dropDownList('country_id','', array(1=>'USA',2=>'France',3=>'Japan'),

array(

'ajax' => array(

'type'=>'POST', //request type

'url'=>CController::createUrl('currentController/dynamiccities'), //url to call.

//Style: CController::createUrl('currentController/methodToCall')

[u]'update'=>'#city_id,#state_id', //selector to update[/u]




Thanks

Well you obviously dont want the same data on the city and state, this might require some more complex javascript than just updating 2 diferent dropdowns.

Do you have an example plz ?

I just want to update 2 differents div at the same time, and the datas will be handled by the controller.

So if the div id is city, the dropdownlist will be filled with appropriate cities, and if the div id is states, the dropdownlist will be filled with appropriate states.

See this thread. The function can be placed inline.

/Tommy

I tried your example and i have the following error : updateFields is not defined :unsure:

I don’t know whether that example is fully functional. (In the example the function block was not closed, perhaps you missed that.)

You can use inline code, something like this




'success'=>'js:function(data){$("#city_id").html(data.city);    $("#state_id").html(data.state);}',



/Tommy

Success and Update can not work at the same Time.If we Use a Success param then we need to right a bit of code there.But Updating a Din better option.

So my question is that. i’ll prefer to update a multiple div at a time.Is there any mean solution for this issue ??. :unsure: