Hi everybody,
I’m trying to update some data of my model inside my view using ajax.
I have this so far:
In my view (index.php):
<?php
echo $this->renderPartial("_ajaxFoto", array('nombre' => $model->nombre_acceso),true)
echo CHtml::ajaxButton ("Update data",Yii::app()->createUrl('perfil/UpdateAjax'),
array('update' => '#fotoPerfil'));
?>
The view that I render (very simple, I’m testing right now) (_ajaxFoto.php):
<?php
echo 'soy ' . $nombre;
?>
and the controller:
public function actionUpdateAjax()
{
$model = $this->loadModel(Yii::app()->user->idUsuario);
$model->nombre_acceso = "foto4 AJAX";
$this->renderPartial('_ajaxFoto', $model->nombre_acceso, false, true);
}
When I press the ajax button the variable $nombre should change to “foto4 AJAX” in my view index.php, but I’m getting a 500 (Internal Server Error) instead and I don’t know why.
Am I doing something wrong? Any help would be great, thanks in advance !! ^^
cheers,
Chema.