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?
You can utilize the same actions to return XML, JSON or whatever, by detecting ajax requests and thus being able to differentiate ajax requests from normal ones. For example:
public function fooAction()
{
if($this->getRequest->isXmlHttpRequest()) {
echo json_encode($someData);
} else {
echo 'This is the normal output';
}
}