My dropdown menu code:
<?php
echo CHtml::dropDownList('symptomCategory', 'symptomCategory',
$this->getSymptomCategories(),
array('id'=>'categorySelectDropDown',
'prompt'=>"Select Symptom Category",
'ajax'=> array(
'type'=>'POST',
'url'=>Yii::app()->createUrl('symptomhistory/updateSymptomsGridView'),
'update'=>'#symptoms-grid',
'data'=>array('symptomCategory'=>'js:this.value')
)
)
);
?>
My controller action code:
public function actionUpdateSymptomsGridView()
{
$symptomsModel = new Symptoms;
if(isset($_POST['symptomCategory']))
{
$symptomsModel->setAttributes(array('symptomCategory'=>$_POST['symptomCategory']));
$dataProvider = $symptomsModel->searchCategory();
return $dataProvider;
}
}
I am using firebug to monitor my webapp and it won't fire the ajax calls when I make the change on the dropdownlist. I checked the produced JS code from yii it's this:
jQuery('body').on('change','#categorySelectDropDown',function(){jQuery.ajax({'type':'POST','url':'/mysymptomsbook/index.php?r=symptomhistory/updateSymptomsGridView','data':{'symptomCategory':this.value},'cache':false,'success':function(html){jQuery("#symptoms-grid").html(html)}});return false;});
It should be working but it's not even making any ajax calls. Can someone please help me find what's wrong