Hi everyone, I followed a wiki on how to make an ajax dependent drop down, I get the following error on firebug "NetworkError: 500 PHP Error - …/index.php/en/showroom/showcity"
My Index.php
echo CHtml::dropDownList('city_id','', array(1=>'London',2=>'Manchester',3=>'Liverpool'),
array(
'ajax' => array(
'type'=>'POST', //request type
'url'=>CController::createUrl('showroom/showcity'), //url to call.
'update'=>'#myID', //selector to update
)));
echo CHtml::dropDownList('myID','', array());
On my controller
public function actionShowcity(){
$data=Showroom::model()->findAll('Title=:Title',
array(':Title'=>(String) $_POST['city_id']));
$data=CHtml::listData($data,'ID','Name');
foreach($data as $value=>$name)
{
echo CHtml::tag('option',
array('value'=>$value),CHtml::encode($name),true);
}
}
I’m guessing it’s my post request on $_POST[‘city_id’] , because if I change that to a string like “London” it works.