I'm going to start a project using a Zend Framework MVC implementation.
How do I work with ajax? I mean, should I place all ajax code into controller? Or into view?
For example, I want to get posts from author 'ivan' to show on a page.
Normally, I create a link to '/posts/author/ivan' or smth like it, create a new Action like 'byAuthorAction()' in the Posts controller (or maybe Users controller, wherever), view for it (and all code what gets posts from model goes there) and create a new Route to it.
How to add functionality to get any user's posts in json, xml formats for ajax and maybe API, keeping the DRY principle and designing the code structure as smart as I can?
--
Thanks for answers! I will be very glad to see comments about designing MVC in situations like mine. I have some experience in basic MVC principles but not in more complicated cases. Maybe some useful links?