And an action defined in my blog controller as follow:
public function actionXhrFilterEntries()
{
...
}
But once I set up the rules for the blog the action xhrFilterEntries is not reachable anymore via a browser, so you guys have any ideas why? Racking my brain about that but cant find any solution
hum I am passing the URL to the JS with the method $this->createUrl()
I really dont see why it doesnt work, but the strange thing is that even after having this rules set up for the blog the xhrFilterEntries() method is not reachable via the browser with the following link:
if you don’t include your rule in matching the URL it wont work at all and will display a 404 error (not found). In your rules there is no way to tell Yii to redirect to controller/action.
By including ‘blog/xhrFilterEntries.html’=>‘blog/xhrFilterEntries’ you are saying to Yii that if there is a match of blog/xhrFilterEntries.html to call blog controller and its xhrFilterEntries action, and if you do createUrl(‘blog/xhrFilterEntries’) will be converted to blog/xhrFilterEntries.html.
"when using createUrl to generate a URL, the route and the GET parameters passed to the method are used to decide which URL rule to be applied. If every parameter associated with a rule can be found in the GET parameters passed to createUrl, and if the route of the rule also matches the route parameter, the rule will be used to generate the URL."