no firebug errors are shown, but I get no response either. What I am trying to do is get additional data from a field in a table, I think that the code in the controller is OK with:
I changed the accessrules() to allow ‘updateajax’ and got:
The requested page does not exist.
Now, in looking at the cookbook, my understanding is that the CController::createUrl(‘album/UpdateAjax’) portion of the ajaxLink() in my original script view.php works like this:
‘album/UpdateAjax’ translates to "look in AlbumController.php for the actionUpdateAjax function and then render a chunk of code from the file named in the renderPartial() portion of the actionUpdateAjax function:
Your right in your understanding. I think your access rules are your problem, can you comment them out and see if it works ? Specifically this request http://localhost/index.php?r=album/UpdateAjax should not give you a 403 error. If it does work post your access rules .
the function actionUpdateAjax in AlbumController.php would then call the view _anothercomment.php , right?
based on the previous accessrules error, it IS calling AlbumController.php, or else it wouldn’t have generated that error, I just can’t figure out why renderPartial isn’t calling for the _anothercomment.php file
at first i got the error "You are not authorized to perform this action." when trying to invoke album/UpdateAjax then I changed accessrules to :
array('allow', // allow all users to perform 'index' and 'view' actions
array('allow', // allow authenticated user to perform 'create' and 'update' actions
array('allow', // allow admin user to perform 'admin' and 'delete' actions
array('deny', // deny all users
after adding ‘updateajax’ to the allow rule in the first section, the error went away, and was replaced by “The requested page does not exist.”
I then further changed it to
after commenting everything else out. No access errors, but still the file not found error
It seems like you verified that lower case is a requirement (feel free to comment or update the cookbook article). A note about the need for adding new actions to accessRules() may also be appropriate.
(Qiang, the convention section of the guide may also need some attention)
Well, I changed the ajaxLink variable to album/updateajax , the controller function from actionUpdateAjax to actionupdateajax, and I still get "The requested page does not exist." when I look at the console in Firebug.
regarding the naming, I gathered that from the way things were named in the accessRules()
well, I tried both ways and it didn’t work from either one… still “The requested page does not exist.”
Does anything jump out at you from the stack trace?? it looks to me like Jquery is still calling the URI from the call to the controller rather than the one I want, which is view/album/_anothercomment.php and which I understood would be created by the renderPartial() call in actionUpdateAjax
Sorry, I didn’t pay attention to the stack traces before. It seems clear that action UpdateAjax is entered in both cases. What’s loadModel()? That’s the last method called. Do you call $this->loadModel(), is the method defined in the controller. What’s in it?
Also, as already suggested, try with view rendering excluded, just echo a string from the controller.
Yii::app()->end(); // or you can call die;
here is the code for loadModel and for actionUpdateAjax. I want to get some data from the AR, and thought I needed to call loadModel() but notice that if the model is null that ‘The requested page does not exist.’ is thrown
notice that I commented out the loadModel call in actionUpdateAjax – when I just ran it, I did not get the error. But I STILL didn’t get the data I wanted for AR either. So I’m probably not accessing that data properly…
BTW here’s the info on $_model (this code generated by yiic)
* @var CActiveRecord the currently loaded data model instance.
public function loadModel()
throw new CHttpException(404,'The requested page does not exist.');
public function actionUpdateAjax()
$data = array();
$data["myValue"] = $model->reviewquote_2;
$this->renderPartial('_anothercomment', $data, false, true);
would I need to pass the id variable from the ajaxLink call in view.php along with the data about the controller file?