I am using the new CakePHP 2.1 and would like to use JsonView to make the controller respond to the ajax request created by client-side jQuery. However, this should be done automatically using JsonView as per the documentation.
http://book.cakephp.org/2.0/en/views/json-and-xml-views.html
I added this line to the routes.php file
Router::parseExtensions('json');
And in my controller I have
$this->RequestHandler->setContent('json', 'application/json' ); $bookings = $this->Bookings->find('all'); $this->set('bookings', $bookings); $this->set('_serialize', 'bookings');
Then the view should be outdated, but when I call it, it still serves a page that points to the missing view.
Chris de rouck
source share