Ive been looking around for an answer but can
t seem to find one
I’m trying to use AJAX to populate a message in one of my views.
here is what I have for code
in my EventController.php I have this
class eventController extends Controller{
....
....
public function actionSchedule()
{
$data = array();
$data["myfiles"] = "File listing";
$this->render('schedule',$data);
}
public function actionUpdateajax($file)
{
$data = array();
$data["myfiles"] = "Files modified with AJAX";
$this->renderPartial('_ajaxcontent', $data, false, true);
}
....
....
}
Now I n my view file (schedule.php) I have
<div id="data">
<?php $this->renderPartial('_ajaxcontent', array('myfiles'=>$myfiles)); ?>
</div>
<?php echo CHtml::ajaxButton ("Update data",
Controller::createUrl('event/Updateajax'),
array('update' => '#data'));
?>
and in the same view directory I have a file called _ajaxcontent.php with the following content
<?php echo $myfiles; ?>
now if I go to my link
mysite/index.php?r=event/schedule it works I see the content "File listing" but when I click on the button it does not give me the content set in actionUpdateajax. am I missing something?
I took this from this wiki
the main diff is that my eventController class extends Controller and not CController. is this why?