yiiuser
(Kenp Khalid)
May 17, 2011, 7:56pm
1
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
Asgaroth
(Asgaroth Belem)
May 17, 2011, 8:20pm
2
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.
yiiuser
(Kenp Khalid)
May 17, 2011, 9:00pm
3
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.
tri
(tri - Tommy Riboe)
May 17, 2011, 9:16pm
4
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
yiiuser
(Kenp Khalid)
May 18, 2011, 4:19pm
5
I tried your example and i have the following error : updateFields is not defined
tri
(tri - Tommy Riboe)
May 18, 2011, 5:30pm
6
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
jayant
(Codesutras)
November 18, 2011, 1:26pm
7
tri:
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 ??.