500 (Internal Server Error) With Ajax

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):


	   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):


	      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 !! ^^



what is the error message inspect the response in console/firebug

also fire up logging on the server side and examine the application.log file. I’m pretty sure the answer will be in it (once logging is enabled).

Hi guys,

thanks for answering Alirz23 and Boaz. I added the log to my application and I saw that my mistake was in the second renderPartial, I was missing the name of the variable, so I added it.

It’s working fine now, thx again !