I have seen many other questions related to this one, I have tried their solutions but it still does not work (same error), reason why I am opening this thread.
Elements: 1 View --> Originates the AJAX request. 1 Controller --> Should handle the AJAX request and return an array.
View:
$(document).ready(function(){ $("button").click(function(){ $("#test").load("<? echo >Yii::app()-createUrl('test/ajax');?>"); }); });
So when I clicked a button with an "id=test", it should go to the TestController and from the actionAjax return a simple array.
The problem I am having is that whenever I click the #test button a 403 Forbidden log is seen in the console (Google Chrome console, for instance).
In the TestController I have the following access rules:
public function accessRules() {
return array(array('allow', 'actions'=array('ajax'), 'users'=array('@'), ), ); }
And of course I do have an action called actionAjax.
Am I missing something here? Is there any rule that I should take into account?
Am I free to make any Ajax call (load, post..) in Yii or there is a convention / function that I should follow?
Thanks for looking into this.